diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..99e7aeef22 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,3 @@ +[*.{kt,kts}] +max_line_length = 120 +disabled_rules=no-wildcard-imports diff --git a/.gitignore b/.gitignore index 17b0d38a93..f05c560f02 100644 --- a/.gitignore +++ b/.gitignore @@ -9,8 +9,13 @@ *.iws out -# ignore .idea directory -.idea/ +# ignore .idea directory, except copyright +!.idea +.idea/* +!.idea/copyright +!.idea/scopes +.idea/scopes/* +!.idea/scopes/copyright.xml # Ant build.xml diff --git a/.idea/copyright/DHIS2.xml b/.idea/copyright/DHIS2.xml new file mode 100644 index 0000000000..114849195a --- /dev/null +++ b/.idea/copyright/DHIS2.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000000..9f573fc027 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/scopes/copyright.xml b/.idea/scopes/copyright.xml new file mode 100644 index 0000000000..2c36356d01 --- /dev/null +++ b/.idea/scopes/copyright.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/build.gradle b/build.gradle index 42b5755011..c1215685ef 100644 --- a/build.gradle +++ b/build.gradle @@ -10,6 +10,7 @@ buildscript { dependencies { classpath "com.android.tools.build:gradle:4.0.1" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "org.jlleitschuh.gradle:ktlint-gradle:9.3.0" } } @@ -30,4 +31,12 @@ task clean(type: Delete) { subprojects { project -> group = GROUP version = VERSION_NAME + + apply plugin: "org.jlleitschuh.gradle.ktlint" + + ktlint { + version = "0.37.2" + android = true + outputColorName = "RED" + } } \ No newline at end of file diff --git a/build.sh b/build.sh index 66ee7db9ed..13724909be 100755 --- a/build.sh +++ b/build.sh @@ -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 checkstyleDebug pmdDebug lintDebug detekt testDebug connectedDebugAndroidTest \ No newline at end of file +"$PROJECT_DIR"/gradlew clean ktlintCheck detekt checkstyleDebug pmdDebug lintDebug testDebug connectedDebugAndroidTest compileReleaseKotlin diff --git a/core/build.gradle b/core/build.gradle index 430a009761..6bb079b2a0 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -30,7 +30,9 @@ plugins { id "com.android.library" id "kotlin-android" id "kotlin-android-extensions" + id "kotlin-kapt" id "io.gitlab.arturbosch.detekt" version "1.10.0" + id "org.jetbrains.dokka" version "1.4.30" apply false } apply from: project.file("plugins/android-checkstyle.gradle") @@ -41,8 +43,8 @@ ext { buildToolsVersion: "29.0.3", minSdkVersion : 19, targetSdkVersion : 29, - versionCode : 232, - versionName : "1.3.2" + versionCode : 240, + versionName : "1.4.0" ] libraries = [ @@ -53,8 +55,8 @@ ext { // java apacheCommons : "3.3.7", jackson : "2.11.2", - autoValue : "1.3", - autoValueCursor : "1.0.1", + autoValue : "1.7.4", + autoValueCursor : "2.0.1", retrofit : "2.6.4", okHttp : "3.12.0", dagger : "2.28.3", @@ -64,24 +66,26 @@ ext { jexl : "2.1.1", jodaTime : "2.10.6", smsCompression : "0.2.0", - antlr : "4.7.2", // Upgrading throws a runtime warning - expressionParser: "1.0.11", + expressionParser: "1.0.15", // test dependencies coreTesting : "1.1.1", jUnit : "4.13", - assertJ : "3.16.1", mockito : "3.4.6", mockitoKotlin : "2.2.0", - truth : "1.0.1", + truth : "1.1.2", testRunner : "1.2.0", equalsVerifier : "3.4.1", - stetho : "1.5.1", + flipper : "0.83.0", + soloader : "0.10.1", liveDataTesting : "1.1.2", commonsLogging : "1.2", // google - safetyNet : "17.0.0", + safetyNet : "17.0.0", + + // open id + appauth : "0.7.1" ] } @@ -163,15 +167,17 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" // Auto Value - compileOnly "com.google.auto.value:auto-value:${libraries.autoValue}" - annotationProcessor "com.google.auto.value:auto-value:${libraries.autoValue}" + api "com.google.auto.value:auto-value-annotations:${libraries.autoValue}" + kapt "com.google.auto.value:auto-value:${libraries.autoValue}" // Dagger api "com.google.dagger:dagger:${libraries.dagger}" - annotationProcessor "com.google.dagger:dagger-compiler:${libraries.dagger}" + kapt "com.google.dagger:dagger-compiler:${libraries.dagger}" // Jackson api "com.fasterxml.jackson.core:jackson-databind:${libraries.jackson}" + api "com.fasterxml.jackson.module:jackson-module-kotlin:${libraries.jackson}" + // Google's play services api "com.google.android.gms:play-services-safetynet:${libraries.safetyNet}" @@ -195,12 +201,11 @@ dependencies { api "com.github.dhis2:sms-compression:${libraries.smsCompression}" // DHIS 2 antlr expression parser - api "org.antlr:antlr4-runtime:${libraries.antlr}" api "org.hisp.dhis.parser:dhis-antlr-expression-parser:${libraries.expressionParser}" // Extension which generates mappers for work with cursor and content values api "com.gabrielittner.auto.value:auto-value-cursor-annotations:${libraries.autoValueCursor}" - annotationProcessor "com.gabrielittner.auto.value:auto-value-cursor:${libraries.autoValueCursor}" + kapt "com.gabrielittner.auto.value:auto-value-cursor:${libraries.autoValueCursor}" api "net.zetetic:android-database-sqlcipher:${libraries.sqlCipher}" @@ -210,7 +215,9 @@ dependencies { testImplementation "junit:junit:${libraries.jUnit}" testImplementation "org.mockito:mockito-core:${libraries.mockito}" testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:${libraries.mockitoKotlin}" - testImplementation "org.assertj:assertj-core:${libraries.assertJ}" + testImplementation("com.google.truth:truth:${libraries.truth}") { + exclude group: 'junit' // Android has JUnit built in. + } testImplementation "nl.jqno.equalsverifier:equalsverifier:${libraries.equalsVerifier}" testImplementation "com.squareup.okhttp3:mockwebserver:${libraries.okHttp}" testImplementation "androidx.test:runner:${libraries.testRunner}" @@ -226,13 +233,15 @@ dependencies { androidTestImplementation("com.google.truth:truth:${libraries.truth}") { exclude group: 'junit' // Android has JUnit built in. } - androidTestImplementation("com.facebook.stetho:stetho:${libraries.stetho}") { - exclude module: 'jsr305' - } - androidTestImplementation("com.facebook.stetho:stetho-okhttp3:${libraries.stetho}") { - exclude module: 'okhttp' - exclude module: 'jsr305' + debugImplementation "com.facebook.flipper:flipper:${libraries.flipper}" + debugImplementation "com.facebook.soloader:soloader:${libraries.soloader}" + debugImplementation ("com.facebook.flipper:flipper-network-plugin:${libraries.flipper}") { + exclude group: 'com.squareup.okhttp3' } + + releaseImplementation "com.facebook.flipper:flipper-noop:${libraries.flipper}" + + implementation "net.openid:appauth:${libraries.appauth}" } apply from: project.file("plugins/gradle-mvn-push.gradle") @@ -244,4 +253,4 @@ repositories { detekt { config = files("config/detekt.yml") buildUponDefaultConfig = false -} +} \ No newline at end of file diff --git a/core/gradle.properties b/core/gradle.properties index 86c2250fed..888c4b4e0e 100644 --- a/core/gradle.properties +++ b/core/gradle.properties @@ -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.3.2 -VERSION_CODE=232 +VERSION_NAME=1.4.0 +VERSION_CODE=240 GROUP=org.hisp.dhis diff --git a/core/plugins/gradle-mvn-push.gradle b/core/plugins/gradle-mvn-push.gradle index ed87885805..a658bbf437 100644 --- a/core/plugins/gradle-mvn-push.gradle +++ b/core/plugins/gradle-mvn-push.gradle @@ -14,8 +14,10 @@ * limitations under the License. */ -apply plugin: "maven" +apply plugin: "maven-publish" apply plugin: "signing" +apply plugin: "org.jetbrains.dokka" + def isReleaseBuild() { return !VERSION_NAME.contains("SNAPSHOT") @@ -51,8 +53,6 @@ def gpgPassphrase() { return hasProperty("GPG_PASSPHRASE") ? GPG_PASSPHRASE : "" } -def tempBuildFolder = "$rootDir/build/deploy" - gradle.taskGraph.whenReady { taskGraph -> if (taskGraph.allTasks.any { it instanceof Sign }) { allprojects { ext."signing.keyId" = gpgKeyId() } @@ -61,194 +61,86 @@ gradle.taskGraph.whenReady { taskGraph -> } } -afterEvaluate { project -> - - uploadArchives { - doFirst { - mkdir "file:/$tempBuildFolder" - } - repositories { - mavenDeployer { - beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } - - pom.groupId = GROUP - pom.artifactId = POM_ARTIFACT_ID - pom.version = VERSION_NAME - - // Hack: Deploy to a local repository first, then upload to Sonatype using scripts. - repository(url: "file://localhost/$tempBuildFolder") { - authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) - } - snapshotRepository(url: getSnapshotRepositoryUrl()) { - authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) - } - - pom.project { - name POM_NAME - packaging POM_PACKAGING - description POM_DESCRIPTION - url POM_URL - - scm { - url POM_SCM_URL - connection POM_SCM_CONNECTION - developerConnection POM_SCM_DEV_CONNECTION - } - - licenses { - license { - name POM_LICENCE_NAME - url POM_LICENCE_URL - distribution POM_LICENCE_DIST - } - } +tasks.named("dokkaJavadoc") { + outputDirectory = file("$buildDir/dokkaJavadoc") - developers { - developer { - id POM_DEVELOPER_ID - name POM_DEVELOPER_NAME - } - } - } + dokkaSourceSets { + configureEach { + perPackageOption { + matchingRegex.set(".*.internal.*") + suppress.set(true) } } } +} - signing { - required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") } - sign configurations.archives - } - - if (project.getPlugins().hasPlugin("com.android.application") || - project.getPlugins().hasPlugin("com.android.library")) { - task install(type: Upload, dependsOn: assemble) { - repositories.mavenInstaller { - configuration = configurations.archives - - pom.groupId = GROUP - pom.artifactId = POM_ARTIFACT_ID - pom.version = VERSION_NAME - - pom.project { - name POM_NAME - packaging POM_PACKAGING - description POM_DESCRIPTION - url POM_URL +task androidJavadocsJar(type: Jar, dependsOn: dokkaJavadoc) { + archiveClassifier.set('javadoc') + from dokkaJavadoc.outputDirectory +} - scm { - url POM_SCM_URL - connection POM_SCM_CONNECTION - developerConnection POM_SCM_DEV_CONNECTION - } +task androidSourcesJar(type: Jar) { + archiveClassifier.set('sources') + from android.sourceSets.main.java.srcDirs +} +afterEvaluate { + publishing { + publications { + release(MavenPublication) { + from components.release + + // Artifacts + artifact androidJavadocsJar + artifact androidSourcesJar + + groupId = GROUP + artifactId = POM_ARTIFACT_ID + version = VERSION_NAME + + pom { + name = POM_NAME + packaging = POM_PACKAGING + description = POM_DESCRIPTION + url = POM_URL licenses { license { - name POM_LICENCE_NAME - url POM_LICENCE_URL - distribution POM_LICENCE_DIST + name = POM_LICENCE_NAME + url = POM_LICENCE_URL + distribution = POM_LICENCE_DIST } } - developers { developer { - id POM_DEVELOPER_ID - name POM_DEVELOPER_NAME + id = POM_DEVELOPER_ID + name = POM_DEVELOPER_NAME } } - } - } - } - - task androidJavadocs(type: Javadoc) { - source = android.sourceSets.main.java.source - classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) - exclude "org/hisp/dhis/android/core/**/internal/**" - exclude "org/hisp/dhis/android/core/**/*InternalAccessor.java" - exclude "org/hisp/dhis/android/core/**/**.kt" - } - - task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) { - classifier = "javadoc" - from androidJavadocs.destinationDir - } - - task androidSourcesJar(type: Jar) { - classifier = "sources" - from android.sourceSets.main.java.source - } - } else { - install { - repositories.mavenInstaller { - pom.groupId = GROUP - pom.artifactId = POM_ARTIFACT_ID - pom.version = VERSION_NAME - - pom.project { - name POM_NAME - packaging POM_PACKAGING - description POM_DESCRIPTION - url POM_URL - scm { - url POM_SCM_URL - connection POM_SCM_CONNECTION - developerConnection POM_SCM_DEV_CONNECTION - } - - licenses { - license { - name POM_LICENCE_NAME - url POM_LICENCE_URL - distribution POM_LICENCE_DIST - } - } - - developers { - developer { - id POM_DEVELOPER_ID - name POM_DEVELOPER_NAME - } + connection = POM_SCM_CONNECTION + developerConnection = POM_SCM_DEV_CONNECTION + url = POM_SCM_URL } } } } - task sourcesJar(type: Jar, dependsOn: classes) { - classifier = "sources" - from sourceSets.main.allSource - } - - task javadocJar(type: Jar, dependsOn: javadoc) { - classifier = "javadoc" - from javadoc.destinationDir - } - } - - artifacts { - if (project.getPlugins().hasPlugin("com.android.application") || - project.getPlugins().hasPlugin("com.android.library")) { - archives androidSourcesJar - archives androidJavadocsJar - } else { - archives sourcesJar - archives javadocJar + repositories { + maven { + def releasesRepoUrl = getReleaseRepositoryUrl() + def snapshotsRepoUrl = getSnapshotRepositoryUrl() + url = isReleaseBuild() ? releasesRepoUrl : snapshotsRepoUrl + + credentials { + username = getRepositoryUsername() + password = getRepositoryPassword() + } + } } } -} - -// Scripted hack, inpired from: -// https://github.com/osmlab/atlas/blob/dev/gradle/deployment.gradle -def uploadToNexusStaging(def username, def password, def repoDir) { - def proc = ['./uploadToNexusStaging.sh', username, password, repoDir].execute([], file("${rootDir.toString()}/core/plugins")) - proc.waitForProcessOutput(System.out, System.err) -} - -task publishToNexus(dependsOn: 'uploadArchives') { - doLast { - if (isReleaseBuild()) { - uploadToNexusStaging(getRepositoryUsername(), getRepositoryPassword(), tempBuildFolder) - } - // If is not a release build, artifacts are deployed in uploadArchives directive + signing { + required { isReleaseBuild() && gradle.taskGraph.hasTask("publishing") } + sign publishing.publications.release } } \ No newline at end of file diff --git a/core/plugins/uploadToNexusStaging.sh b/core/plugins/uploadToNexusStaging.sh deleted file mode 100755 index f4f293f77c..0000000000 --- a/core/plugins/uploadToNexusStaging.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env bash - -export NEXUS_USERNAME=$1 -export NEXUS_PASSWORD=$2 -export REPOSITORY_DIR=$3 - -export API_ENDPOINT=https://oss.sonatype.org/service/local/staging - -export DHIS2_PROFILE_ID="a87d019c1e07" - -export DESCRIPTION_PAYLOAD="\ - \ - DHIS2 Android SDK Release\ - \ -" - -# Create staging repo -export STAGING_ID=$(curl -s -u $NEXUS_USERNAME:$NEXUS_PASSWORD \ - -X POST \ - -H "Content-Type:application/xml" \ - -d "$DESCRIPTION_PAYLOAD" \ - "$API_ENDPOINT/profiles/$DHIS2_PROFILE_ID/start" \ - | perl -nle 'print "$1" if ($_ =~ /.*(.*)<\/stagedRepositoryId>.*/g);' \ - | awk '{$1=$1};1') - -find $REPOSITORY_DIR -type f | while read f; do - suffix=$(echo $f | sed "s%^$REPOSITORY_DIR/%%") - echo "Uploading to: ${STAGING_ID}: ${suffix}" - curl -s -u $NEXUS_USERNAME:$NEXUS_PASSWORD -H "Content-type: application/x-rpm" --upload-file $f ${API_ENDPOINT}/deployByRepositoryId/${STAGING_ID}/${suffix} -done - -echo "sleep 20 seconds before closing" -sleep 20 \ No newline at end of file diff --git a/core/src/androidTest/AndroidManifest.xml b/core/src/androidTest/AndroidManifest.xml index 0f6808453b..c2649403fe 100644 --- a/core/src/androidTest/AndroidManifest.xml +++ b/core/src/androidTest/AndroidManifest.xml @@ -33,9 +33,11 @@ + tools:replace="android:label"> + diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/AndroidTestUtils.java b/core/src/androidTest/java/org/hisp/dhis/android/core/AndroidTestUtils.java index e3fba8d6c8..fa41d894dd 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/AndroidTestUtils.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/AndroidTestUtils.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/BaseIntegrationTestWithDatabase.java b/core/src/androidTest/java/org/hisp/dhis/android/core/BaseIntegrationTestWithDatabase.java index 2420c19374..4c6b9d7265 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/BaseIntegrationTestWithDatabase.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/BaseIntegrationTestWithDatabase.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/BaseRealIntegrationTest.java b/core/src/androidTest/java/org/hisp/dhis/android/core/BaseRealIntegrationTest.java index 0948b0915c..d6e80a7958 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/BaseRealIntegrationTest.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/BaseRealIntegrationTest.java @@ -1,39 +1,33 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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; -import android.content.Context; - -import androidx.test.platform.app.InstrumentationRegistry; - -import com.facebook.stetho.Stetho; - import org.hisp.dhis.android.core.arch.call.internal.GenericCallData; import org.hisp.dhis.android.core.arch.d2.internal.D2DIComponent; import org.hisp.dhis.android.core.data.server.RealServerMother; @@ -50,8 +44,6 @@ public abstract class BaseRealIntegrationTest { @Before public void setUp() throws IOException { - Context context = InstrumentationRegistry.getInstrumentation().getContext(); - Stetho.initializeWithDefaults(context); } protected GenericCallData getGenericCallData(D2 d2) { diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/D2DIComponentAccessor.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/D2DIComponentAccessor.kt index f7300fc16b..085cd0d6e9 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/D2DIComponentAccessor.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/D2DIComponentAccessor.kt @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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 @@ -33,4 +33,4 @@ object D2DIComponentAccessor { fun getD2DIComponent(d2: D2): D2DIComponent { return d2.d2DIComponent } -} \ No newline at end of file +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/D2Factory.java b/core/src/androidTest/java/org/hisp/dhis/android/core/D2Factory.java index 7929f9e6d5..c9acbf8d0e 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/D2Factory.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/D2Factory.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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; @@ -32,8 +32,7 @@ import androidx.test.platform.app.InstrumentationRegistry; -import com.facebook.stetho.okhttp3.StethoInterceptor; - +import org.hisp.dhis.android.core.debug.flipper.debug.FlipperManager; import org.hisp.dhis.android.core.arch.storage.internal.AndroidInsecureStore; import org.hisp.dhis.android.core.arch.storage.internal.AndroidSecureStore; import org.hisp.dhis.android.core.arch.storage.internal.InMemorySecureStore; @@ -72,15 +71,16 @@ private static D2 forNewDatabaseInternal(SecureStore secureStore, InsecureStore return d2; } - public static D2Configuration d2Configuration(Context context) { + private static D2Configuration d2Configuration(Context context) { HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(); loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BASIC); + return D2Configuration.builder() .appVersion("1.0.0") .readTimeoutInSeconds(30) .connectTimeoutInSeconds(30) .writeTimeoutInSeconds(30) - .networkInterceptors(Collections.singletonList(new StethoInterceptor())) + .networkInterceptors(Collections.singletonList(FlipperManager.setUp(context))) .interceptors(Collections.singletonList(loggingInterceptor)) .context(context) .build(); diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/EventWithLimitCallMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/EventWithLimitCallMockIntegrationShould.java deleted file mode 100644 index 1298c99de1..0000000000 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/EventWithLimitCallMockIntegrationShould.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2004-2019, 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; - -import org.hisp.dhis.android.core.event.Event; -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; -import org.junit.runner.RunWith; - -import java.util.List; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; - -@RunWith(D2JunitRunner.class) -public class EventWithLimitCallMockIntegrationShould extends BaseMockIntegrationTestMetadataEnqueable { - - @Test - public void download_events() { - int eventLimitByOrgUnit = 1; - - dhis2MockServer.enqueueMockResponse("systeminfo/system_info.json"); - dhis2MockServer.enqueueMockResponse("event/events_1.json"); - - d2.eventModule().eventDownloader().limit(eventLimitByOrgUnit).blockingDownload(); - - EventStore eventStore = EventStoreImpl.create(databaseAdapter); - - List downloadedEvents = eventStore.querySingleEvents(); - - assertThat(downloadedEvents.size(), is(eventLimitByOrgUnit)); - } -} \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/EventWithLimitCallMockIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/EventWithLimitCallMockIntegrationShould.kt new file mode 100644 index 0000000000..a28c654219 --- /dev/null +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/EventWithLimitCallMockIntegrationShould.kt @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2004-2021, 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 + +import com.google.common.truth.Truth +import org.hisp.dhis.android.core.event.internal.EventStoreImpl +import org.hisp.dhis.android.core.maintenance.D2Error +import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestMetadataEnqueable +import org.hisp.dhis.android.core.utils.runner.D2JunitRunner +import org.junit.After +import org.junit.Test +import org.junit.runner.RunWith + +@RunWith(D2JunitRunner::class) +class EventWithLimitCallMockIntegrationShould : BaseMockIntegrationTestMetadataEnqueable() { + + @After + @Throws(D2Error::class) + fun tearDown() { + d2.wipeModule().wipeData() + } + + @Test + fun download_events() { + val eventLimitByOrgUnit = 1 + dhis2MockServer.enqueueSystemInfoResponse() + dhis2MockServer.enqueueMockResponse("event/events_1.json") + d2.eventModule().eventDownloader().limit(eventLimitByOrgUnit).blockingDownload() + val eventStore = EventStoreImpl.create(databaseAdapter) + val downloadedEvents = eventStore.querySingleEvents() + Truth.assertThat(downloadedEvents.size).isEqualTo(eventLimitByOrgUnit) + } + + // @Test TODO https://jira.dhis2.org/browse/ANDROSDK-1328 + fun download_events_by_uid_limited_by_one() { + val eventLimitByOrgUnit = 1 + dhis2MockServer.enqueueSystemInfoResponse() + dhis2MockServer.enqueueMockResponse("event/events_with_uids.json") + d2.eventModule().eventDownloader() + .byUid() + .`in`("wAiGPfJGMxt", "PpNGhvEYnXe") + .limit(eventLimitByOrgUnit) + .blockingDownload() + val eventStore = EventStoreImpl.create(databaseAdapter) + val downloadedEvents = eventStore.querySingleEvents() + Truth.assertThat(downloadedEvents.size).isEqualTo(eventLimitByOrgUnit) + } +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/LogInCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/LogInCallRealIntegrationShould.java new file mode 100644 index 0000000000..dc725a7c16 --- /dev/null +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/LogInCallRealIntegrationShould.java @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2004-2021, 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; + +import org.hisp.dhis.android.core.data.server.RealServerMother; +import org.junit.Before; + +import java.io.IOException; + +public class LogInCallRealIntegrationShould extends BaseRealIntegrationTest { + + private D2 d2; + + @Before + @Override + public void setUp() throws IOException { + super.setUp(); + + d2 = D2Factory.forNewDatabase(); + } + + //@Test + public void not_wipe_after_second_login_with_same_user() throws Exception { + d2.userModule().logIn(username, password, url).blockingGet(); + + d2.metadataModule().blockingDownload(); + + d2.userModule().logOut().blockingAwait(); + d2.userModule().logIn(username, password, url).blockingGet(); + } + + //@Test + public void wipe_after_second_login_with_different_user() throws Exception { + d2.userModule().logIn(username, password, url).blockingGet(); + + d2.metadataModule().blockingDownload(); + + d2.userModule().logOut().blockingAwait(); + d2.userModule().logIn("admin", "district", url).blockingGet(); + } + + //@Test + public void wipe_after_second_login_with_equivalent_user_in_different_server() throws Exception { + d2.userModule().logIn(username, password, RealServerMother.url2_29).blockingGet(); + + d2.metadataModule().blockingDownload(); + + d2.userModule().logOut().blockingAwait(); + d2.userModule().logIn(username, password, RealServerMother.android_current).blockingGet(); + } +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/MetadataCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/MetadataCallRealIntegrationShould.java index eee08bdf16..c7411c5248 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/MetadataCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/MetadataCallRealIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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; @@ -76,6 +76,7 @@ public void response_successful_on_sync_meta_data_once() throws Exception { d2.metadataModule().blockingDownload(); + //TODO: add additional sync + break point. //when debugger stops at the new break point manually change metadata online & resume. //This way I can make sure that additive (updates) work as well. diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/MockIntegrationTestObjects.java b/core/src/androidTest/java/org/hisp/dhis/android/core/MockIntegrationTestObjects.java index 2f6b1cc67e..6b8c9b7708 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/MockIntegrationTestObjects.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/MockIntegrationTestObjects.java @@ -1,40 +1,35 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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; -import android.content.Context; import android.util.Log; -import androidx.test.platform.app.InstrumentationRegistry; - -import com.facebook.stetho.Stetho; - import org.hisp.dhis.android.core.arch.d2.internal.D2DIComponent; import org.hisp.dhis.android.core.arch.db.access.DatabaseAdapter; import org.hisp.dhis.android.core.mockwebserver.Dhis2MockServer; @@ -59,9 +54,6 @@ public class MockIntegrationTestObjects { public MockIntegrationTestObjects(MockIntegrationTestDatabaseContent content) throws Exception { this.content = content; - Context context = InstrumentationRegistry.getInstrumentation().getContext(); - Stetho.initializeWithDefaults(context); - dhis2MockServer = new Dhis2MockServer(0); CalendarProviderFactory.setFixed(); diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/MultiUserMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/MultiUserMockIntegrationShould.java index fe2cf91080..2730c5a4a8 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/MultiUserMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/MultiUserMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/MultiUserRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/MultiUserRealIntegrationShould.java index 4c6c7044f1..cbea12f2d3 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/MultiUserRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/MultiUserRealIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/TeisCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/TeisCallRealIntegrationShould.java index a50f76c86f..8fa49584b7 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/TeisCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/TeisCallRealIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/UserAuthenticateCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/UserAuthenticateCallRealIntegrationShould.java deleted file mode 100644 index 75c40f424c..0000000000 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/UserAuthenticateCallRealIntegrationShould.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2004-2019, 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; - -import org.hisp.dhis.android.core.data.server.RealServerMother; -import org.junit.Before; - -import java.io.IOException; - -public class UserAuthenticateCallRealIntegrationShould extends BaseRealIntegrationTest { - - private D2 d2; - - @Before - @Override - public void setUp() throws IOException { - super.setUp(); - - d2 = D2Factory.forNewDatabase(); - } - - //@Test - public void not_wipe_after_second_login_with_same_user() throws Exception { - d2.userModule().logIn(username, password, url).blockingGet(); - - d2.metadataModule().blockingDownload(); - - d2.userModule().logOut().blockingAwait(); - d2.userModule().logIn(username, password, url).blockingGet(); - } - - //@Test - public void wipe_after_second_login_with_different_user() throws Exception { - d2.userModule().logIn(username, password, url).blockingGet(); - - d2.metadataModule().blockingDownload(); - - d2.userModule().logOut().blockingAwait(); - d2.userModule().logIn("admin", "district", url).blockingGet(); - } - - //@Test - public void wipe_after_second_login_with_equivalent_user_in_different_server() throws Exception { - d2.userModule().logIn(username, password, RealServerMother.url2_29).blockingGet(); - - d2.metadataModule().blockingDownload(); - - d2.userModule().logOut().blockingAwait(); - d2.userModule().logIn(username, password, RealServerMother.android_current).blockingGet(); - } -} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/analytics/eventlinelist/EventLineListIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/analytics/eventlinelist/EventLineListIntegrationShould.kt new file mode 100644 index 0000000000..8d361bf24c --- /dev/null +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/analytics/eventlinelist/EventLineListIntegrationShould.kt @@ -0,0 +1,376 @@ +/* + * Copyright (c) 2004-2021, 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.eventlinelist + +import com.google.common.truth.Truth.assertThat +import org.hisp.dhis.android.core.analytics.eventlinelist.EventLineListSamples.categoryCombo +import org.hisp.dhis.android.core.analytics.eventlinelist.EventLineListSamples.categoryOptionCombo +import org.hisp.dhis.android.core.analytics.eventlinelist.EventLineListSamples.dataElement1 +import org.hisp.dhis.android.core.analytics.eventlinelist.EventLineListSamples.dataElement2 +import org.hisp.dhis.android.core.analytics.eventlinelist.EventLineListSamples.enrollment +import org.hisp.dhis.android.core.analytics.eventlinelist.EventLineListSamples.organisationUnit1 +import org.hisp.dhis.android.core.analytics.eventlinelist.EventLineListSamples.program1 +import org.hisp.dhis.android.core.analytics.eventlinelist.EventLineListSamples.program1Stage1 +import org.hisp.dhis.android.core.analytics.eventlinelist.EventLineListSamples.program1Stage2 +import org.hisp.dhis.android.core.analytics.eventlinelist.EventLineListSamples.trackedEntityInstance +import org.hisp.dhis.android.core.analytics.eventlinelist.EventLineListSamples.trackedEntityType +import org.hisp.dhis.android.core.analytics.linelist.EventLineListParams +import org.hisp.dhis.android.core.analytics.linelist.EventLineListService +import org.hisp.dhis.android.core.analytics.linelist.EventLineListServiceImpl +import org.hisp.dhis.android.core.analytics.linelist.LineListItem +import org.hisp.dhis.android.core.category.internal.CategoryComboStore +import org.hisp.dhis.android.core.category.internal.CategoryOptionComboStoreImpl +import org.hisp.dhis.android.core.common.BaseIdentifiableObject +import org.hisp.dhis.android.core.dataelement.internal.DataElementStore +import org.hisp.dhis.android.core.enrollment.internal.EnrollmentStoreImpl +import org.hisp.dhis.android.core.event.Event +import org.hisp.dhis.android.core.event.internal.EventStoreImpl +import org.hisp.dhis.android.core.organisationunit.internal.OrganisationUnitStore +import org.hisp.dhis.android.core.period.PeriodType +import org.hisp.dhis.android.core.program.ProgramIndicator +import org.hisp.dhis.android.core.program.internal.ProgramIndicatorStore +import org.hisp.dhis.android.core.program.internal.ProgramStageStore +import org.hisp.dhis.android.core.program.internal.ProgramStore +import org.hisp.dhis.android.core.trackedentity.TrackedEntityDataValue +import org.hisp.dhis.android.core.trackedentity.internal.TrackedEntityDataValueStoreImpl +import org.hisp.dhis.android.core.trackedentity.internal.TrackedEntityInstanceStoreImpl +import org.hisp.dhis.android.core.trackedentity.internal.TrackedEntityTypeStore +import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestEmptyDispatcher +import org.hisp.dhis.android.core.utils.runner.D2JunitRunner +import org.junit.After +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith + +@RunWith(D2JunitRunner::class) +class EventLineListIntegrationShould : BaseMockIntegrationTestEmptyDispatcher() { + + private val eventLineListService: EventLineListService = EventLineListServiceImpl( + eventRepository = d2.eventModule().events(), + dataValueRepository = d2.trackedEntityModule().trackedEntityDataValues(), + dataElementRepository = d2.dataElementModule().dataElements(), + programIndicatorRepository = d2.programModule().programIndicators(), + organisationUnitRepository = d2.organisationUnitModule().organisationUnits(), + programStageRepository = d2.programModule().programStages(), + programIndicatorEngine = d2.programModule().programIndicatorEngine(), + periodHelper = d2.periodModule().periodHelper() + ) + + // Stores + private val trackedEntityTypeStore = TrackedEntityTypeStore.create(databaseAdapter) + private val categoryComboStore = CategoryComboStore.create(databaseAdapter) + private val categoryOptionComboStore = CategoryOptionComboStoreImpl.create(databaseAdapter) + private val programStore = ProgramStore.create(databaseAdapter) + private val programStageStore = ProgramStageStore.create(databaseAdapter) + private val dataElementStore = DataElementStore.create(databaseAdapter) + private val organisationUnitStore = OrganisationUnitStore.create(databaseAdapter) + private val trackedEntityInstanceStore = TrackedEntityInstanceStoreImpl.create(databaseAdapter) + private val eventStore = EventStoreImpl.create(databaseAdapter) + private val trackedEntityDataValueStore = TrackedEntityDataValueStoreImpl.create(databaseAdapter) + private val programIndicatorStore = ProgramIndicatorStore.create(databaseAdapter) + private val enrollmentStore = EnrollmentStoreImpl.create(databaseAdapter) + + @Before + fun setUp() { + setUpClass() + + trackedEntityTypeStore.insert(trackedEntityType) + + categoryComboStore.insert(categoryCombo) + categoryOptionComboStore.insert(categoryOptionCombo) + + programStore.insert(program1) + programStageStore.insert(program1Stage1) + programStageStore.insert(program1Stage2) + + dataElementStore.insert(dataElement1) + dataElementStore.insert(dataElement2) + + organisationUnitStore.insert(organisationUnit1) + + createTei() + createEnrollment() + } + + @After + fun tearDown() { + trackedEntityTypeStore.delete() + categoryComboStore.delete() + categoryOptionComboStore.delete() + programStore.delete() + programStageStore.delete() + dataElementStore.delete() + organisationUnitStore.delete() + trackedEntityInstanceStore.delete() + eventStore.delete() + trackedEntityDataValueStore.delete() + programIndicatorStore.delete() + enrollmentStore.delete() + } + + @Test + fun should_return_single_data_element_in_repeatable_stage() { + val event1 = createEvent(program1Stage2.uid(), "2020-08-01T00:00:00.000") + val event2 = createEvent(program1Stage2.uid(), "2020-09-02T00:00:00.000") + val event3 = createEvent(program1Stage2.uid(), "2020-10-03T00:00:00.000") + + createDataValue(event1.uid(), dataElement1.uid(), "1.0") + createDataValue(event2.uid(), dataElement1.uid(), "2.0") + createDataValue(event3.uid(), dataElement1.uid(), "3.0") + + val eventListParams = EventLineListParams( + programStage = program1Stage2.uid(), + trackedEntityInstance = trackedEntityInstance.uid(), + dataElements = listOf(LineListItem(dataElement1.uid())) + ) + + val result = eventLineListService.evaluate(eventListParams) + + assertThat(result.size).isEqualTo(3) + result.forEach { + when (it.uid) { + event1.uid() -> assertThat(it.period.periodId()).isEqualTo("20200801") + event2.uid() -> assertThat(it.period.periodId()).isEqualTo("20200902") + event3.uid() -> assertThat(it.period.periodId()).isEqualTo("20201003") + } + } + + assertThat(result.all { it.organisationUnit == organisationUnit1.uid() }).isTrue() + assertThat(result.all { it.organisationUnitName == organisationUnit1.displayName() }).isTrue() + + assertThat(result.all { it.values.size == 1 }).isTrue() + assertThat(result.all { it.values[0].uid == dataElement1.uid() }).isTrue() + assertThat(result.all { it.values[0].displayName == dataElement1.displayName() }).isTrue() + + result.forEach { + when (it.uid) { + event1.uid() -> assertThat(it.values[0].value).isEqualTo("1.0") + event2.uid() -> assertThat(it.values[0].value).isEqualTo("2.0") + event3.uid() -> assertThat(it.values[0].value).isEqualTo("3.0") + } + } + } + + @Test + fun should_return_several_data_elements_in_repeatable_stage() { + val event1 = createEvent(program1Stage2.uid(), "2020-08-01T00:00:00.000") + val event2 = createEvent(program1Stage2.uid(), "2020-09-02T00:00:00.000") + + createDataValue(event1.uid(), dataElement1.uid(), "1.0") + createDataValue(event1.uid(), dataElement2.uid(), "10.0") + createDataValue(event2.uid(), dataElement1.uid(), "2.0") + createDataValue(event2.uid(), dataElement2.uid(), "20.0") + + val eventListParams = EventLineListParams( + programStage = program1Stage2.uid(), + trackedEntityInstance = trackedEntityInstance.uid(), + dataElements = listOf(LineListItem(dataElement1.uid()), LineListItem(dataElement2.uid())) + ) + + val result = eventLineListService.evaluate(eventListParams) + + assertThat(result.size).isEqualTo(2) + assertThat(result.all { it.values.size == 2 }).isTrue() + } + + @Test + fun should_return_missing_data_elements_in_repeatable_stage() { + val event1 = createEvent(program1Stage2.uid(), "2020-08-01T00:00:00.000") + val event2 = createEvent(program1Stage2.uid(), "2020-09-02T00:00:00.000") + + createDataValue(event1.uid(), dataElement1.uid(), "1.0") + createDataValue(event2.uid(), dataElement1.uid(), "2.0") + createDataValue(event2.uid(), dataElement2.uid(), "20.0") + + val eventListParams = EventLineListParams( + programStage = program1Stage2.uid(), + trackedEntityInstance = trackedEntityInstance.uid(), + dataElements = listOf(LineListItem(dataElement1.uid()), LineListItem(dataElement2.uid())) + ) + + val result = eventLineListService.evaluate(eventListParams) + + assertThat(result.size).isEqualTo(2) + assertThat(result.all { it.values.size == 2 }).isTrue() + result.forEach { + when (it.uid) { + event1.uid() -> { + assertThat(it.values[0].value).isEqualTo("1.0") + assertThat(it.values[1].value).isNull() + } + event2.uid() -> { + assertThat(it.values[0].value).isEqualTo("2.0") + assertThat(it.values[1].value).isEqualTo("20.0") + } + } + } + } + + @Test + fun should_return_program_indicators_in_repeatable_stage() { + val event1 = createEvent(program1Stage2.uid(), "2020-08-01T00:00:00.000") + val event2 = createEvent(program1Stage2.uid(), "2020-09-02T00:00:00.000") + + createDataValue(event1.uid(), dataElement1.uid(), "1.0") + createDataValue(event1.uid(), dataElement2.uid(), "10.0") + createDataValue(event2.uid(), dataElement1.uid(), "2.0") + createDataValue(event2.uid(), dataElement2.uid(), "20.5") + + val programIndicator = createProgramIndicator( + "#{${program1Stage2.uid()}.${dataElement1.uid()}} + #{${program1Stage2.uid()}.${dataElement2.uid()}}" + ) + + val eventListParams = EventLineListParams( + programStage = program1Stage2.uid(), + trackedEntityInstance = trackedEntityInstance.uid(), + programIndicators = listOf(LineListItem(programIndicator.uid())) + ) + + val result = eventLineListService.evaluate(eventListParams) + + assertThat(result.size).isEqualTo(2) + assertThat(result.all { it.values.size == 1 }).isTrue() + result.forEach { + when (it.uid) { + event1.uid() -> assertThat(it.values[0].value).isEqualTo("11") + event2.uid() -> assertThat(it.values[0].value).isEqualTo("22.5") + } + } + } + + @Test + fun should_ignore_deleted_events() { + val event1 = createEvent(program1Stage2.uid(), "2020-08-01T00:00:00.000") + val deletedEvent = createDeletedEvent(program1Stage2.uid(), "2020-09-02T00:00:00.000") + + createDataValue(event1.uid(), dataElement1.uid(), "1.0") + createDataValue(deletedEvent.uid(), dataElement1.uid(), "10.0") + + val programIndicator = createProgramIndicator("#{${program1Stage2.uid()}.${dataElement1.uid()}}") + + val eventListParams = EventLineListParams( + programStage = program1Stage2.uid(), + trackedEntityInstance = trackedEntityInstance.uid(), + programIndicators = listOf(LineListItem(programIndicator.uid())) + ) + + val result = eventLineListService.evaluate(eventListParams) + + assertThat(result.size).isEqualTo(1) + assertThat(result.first().values.size).isEqualTo(1) + assertThat(result.first().values.first().value).isEqualTo("1") + } + + @Test + fun should_return_program_stage_period_if_defined() { + val event1 = createEvent(program1Stage2.uid(), "2020-08-01T00:00:00.000") + val event2 = createEvent(program1Stage2.uid(), "2020-09-02T00:00:00.000") + val event3 = createEvent(program1Stage2.uid(), "2020-10-03T00:00:00.000") + + val updatedStage = program1Stage2.toBuilder().periodType(PeriodType.Monthly).build() + programStageStore.update(updatedStage) + + val eventListParams = EventLineListParams( + programStage = program1Stage2.uid(), + trackedEntityInstance = trackedEntityInstance.uid(), + dataElements = listOf(LineListItem(dataElement1.uid())) + ) + + val result = eventLineListService.evaluate(eventListParams) + + assertThat(result.size).isEqualTo(3) + result.forEach { + when (it.uid) { + event1.uid() -> assertThat(it.period.periodId()).isEqualTo("202008") + event2.uid() -> assertThat(it.period.periodId()).isEqualTo("202009") + event3.uid() -> assertThat(it.period.periodId()).isEqualTo("202010") + } + } + } + + @Test + fun should_consider_due_events() { + val event1 = createEvent(program1Stage2.uid(), "2020-08-01T00:00:00.000") + val event2 = createDueEvent(program1Stage2.uid(), "2020-09-02T00:00:00.000") + + val eventListParams = EventLineListParams( + programStage = program1Stage2.uid(), + trackedEntityInstance = trackedEntityInstance.uid(), + dataElements = listOf(LineListItem(dataElement1.uid())) + ) + + val result = eventLineListService.evaluate(eventListParams) + + assertThat(result.size).isEqualTo(2) + result.forEach { + when (it.uid) { + event1.uid() -> assertThat(it.period.periodId()).isEqualTo("20200801") + event2.uid() -> assertThat(it.period.periodId()).isEqualTo("20200902") + } + } + } + + private fun createTei() { + trackedEntityInstanceStore.insert(trackedEntityInstance) + } + + private fun createEnrollment() { + enrollmentStore.insert(enrollment) + } + + private fun createEvent(programStageId: String, eventDate: String): Event { + val event = EventLineListSamples.event(programStageId, BaseIdentifiableObject.parseDate(eventDate)) + eventStore.insert(event) + return event + } + + private fun createDueEvent(programStageId: String, dueDate: String): Event { + val event = EventLineListSamples.dueEvent(programStageId, BaseIdentifiableObject.parseDate(dueDate)) + eventStore.insert(event) + return event + } + + private fun createDeletedEvent(programStageId: String, eventDate: String): Event { + val event = EventLineListSamples + .event(programStageId, BaseIdentifiableObject.parseDate(eventDate)) + .toBuilder().deleted(true).build() + eventStore.insert(event) + return event + } + + private fun createDataValue(eventId: String, dataElementId: String, value: String) { + val dataValue = TrackedEntityDataValue.builder().event(eventId).dataElement(dataElementId).value(value).build() + trackedEntityDataValueStore.insert(dataValue) + } + + private fun createProgramIndicator(expression: String): ProgramIndicator { + val programIndicator = EventLineListSamples.programIndicator(expression) + programIndicatorStore.insert(programIndicator) + return programIndicator + } +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/analytics/eventlinelist/EventLineListSamples.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/analytics/eventlinelist/EventLineListSamples.kt new file mode 100644 index 0000000000..cbd03d5612 --- /dev/null +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/analytics/eventlinelist/EventLineListSamples.kt @@ -0,0 +1,153 @@ +/* + * Copyright (c) 2004-2021, 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.eventlinelist + +import java.util.* +import org.hisp.dhis.android.core.arch.helpers.UidGeneratorImpl +import org.hisp.dhis.android.core.category.CategoryCombo +import org.hisp.dhis.android.core.category.CategoryOptionCombo +import org.hisp.dhis.android.core.common.AggregationType +import org.hisp.dhis.android.core.common.FormType +import org.hisp.dhis.android.core.common.ObjectWithUid +import org.hisp.dhis.android.core.common.ValueType +import org.hisp.dhis.android.core.dataelement.DataElement +import org.hisp.dhis.android.core.enrollment.Enrollment +import org.hisp.dhis.android.core.event.Event +import org.hisp.dhis.android.core.organisationunit.OrganisationUnit +import org.hisp.dhis.android.core.program.Program +import org.hisp.dhis.android.core.program.ProgramIndicator +import org.hisp.dhis.android.core.program.ProgramStage +import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstance +import org.hisp.dhis.android.core.trackedentity.TrackedEntityType + +object EventLineListSamples { + + val generator = UidGeneratorImpl() + + val trackedEntityType: TrackedEntityType = TrackedEntityType.builder() + .uid(generator.generate()) + .displayName("Tracked Entity Instance") + .build() + + val categoryCombo: CategoryCombo = CategoryCombo.builder() + .uid(generator.generate()) + .build() + + val categoryOptionCombo: CategoryOptionCombo = CategoryOptionCombo.builder() + .uid(generator.generate()) + .categoryCombo(ObjectWithUid.fromIdentifiable(categoryCombo)) + .build() + + val program1: Program = Program.builder() + .uid(generator.generate()) + .displayName("Program 1") + .trackedEntityType(trackedEntityType) + .categoryCombo(ObjectWithUid.fromIdentifiable(categoryCombo)) + .build() + + val program1Stage1: ProgramStage = ProgramStage.builder() + .uid(generator.generate()) + .displayName("Program 1 Stage 1") + .program(ObjectWithUid.fromIdentifiable(program1)) + .repeatable(false) + .formType(FormType.DEFAULT) + .build() + + val program1Stage2: ProgramStage = ProgramStage.builder() + .uid(generator.generate()) + .displayName("Program 1 Stage 2") + .program(ObjectWithUid.fromIdentifiable(program1)) + .repeatable(true) + .formType(FormType.DEFAULT) + .build() + + val organisationUnit1: OrganisationUnit = OrganisationUnit.builder() + .uid(generator.generate()) + .displayName("Organisation unit 1") + .build() + + val trackedEntityInstance: TrackedEntityInstance = TrackedEntityInstance.builder() + .uid(generator.generate()) + .organisationUnit(organisationUnit1.uid()) + .build() + + val enrollment: Enrollment = Enrollment.builder() + .uid(generator.generate()) + .program(program1.uid()) + .trackedEntityInstance(trackedEntityInstance.uid()) + .organisationUnit(organisationUnit1.uid()) + .build() + + val dataElement1: DataElement = DataElement.builder() + .uid(generator.generate()) + .displayName("Data Element 1") + .valueType(ValueType.NUMBER) + .categoryCombo(ObjectWithUid.fromIdentifiable(categoryCombo)) + .build() + + val dataElement2: DataElement = DataElement.builder() + .uid(generator.generate()) + .displayName("Data Element 2") + .valueType(ValueType.NUMBER) + .categoryCombo(ObjectWithUid.fromIdentifiable(categoryCombo)) + .build() + + fun programIndicator(expression: String): ProgramIndicator = ProgramIndicator.builder() + .uid(generator.generate()) + .displayName("Program Indicator 1") + .program(ObjectWithUid.fromIdentifiable(program1)) + .expression(expression) + .aggregationType(AggregationType.SUM) + .build() + + fun event(programStage: String, eventDate: Date): Event { + return Event.builder() + .uid(generator.generate()) + .program(program1.uid()) + .programStage(programStage) + .eventDate(eventDate) + .enrollment(enrollment.uid()) + .organisationUnit(organisationUnit1.uid()) + .attributeOptionCombo(categoryOptionCombo.uid()) + .deleted(false) + .build() + } + + fun dueEvent(programStage: String, dueDate: Date): Event { + return Event.builder() + .uid(generator.generate()) + .program(program1.uid()) + .programStage(programStage) + .dueDate(dueDate) + .enrollment(enrollment.uid()) + .organisationUnit(organisationUnit1.uid()) + .attributeOptionCombo(categoryOptionCombo.uid()) + .deleted(false) + .build() + } +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/arch/db/access/SqliteCheckerUtility.java b/core/src/androidTest/java/org/hisp/dhis/android/core/arch/db/access/SqliteCheckerUtility.java index ba8143f0f0..ebf351fc18 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/arch/db/access/SqliteCheckerUtility.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/arch/db/access/SqliteCheckerUtility.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.arch.db.access; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/arch/db/access/internal/DatabaseAdapterFactoryIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/arch/db/access/internal/DatabaseAdapterFactoryIntegrationShould.java index 995d4dbd63..9a1295a5b1 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/arch/db/access/internal/DatabaseAdapterFactoryIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/arch/db/access/internal/DatabaseAdapterFactoryIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.arch.db.access.internal; @@ -53,7 +53,7 @@ public static void setUpClass() { @AfterClass public static void tearDownClass() { Context context = InstrumentationRegistry.getInstrumentation().getContext(); - context.deleteDatabase(DB_NAME + ".db"); + context.deleteDatabase(DB_NAME); } @Test diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/arch/db/access/internal/DatabaseFromMigrationsIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/arch/db/access/internal/DatabaseFromMigrationsIntegrationShould.kt new file mode 100644 index 0000000000..7cadbffa13 --- /dev/null +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/arch/db/access/internal/DatabaseFromMigrationsIntegrationShould.kt @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2004-2021, 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.arch.db.access.internal + +import androidx.test.platform.app.InstrumentationRegistry +import com.google.common.truth.Truth.assertThat +import org.hisp.dhis.android.core.arch.db.access.DatabaseAdapter +import org.hisp.dhis.android.core.arch.db.cursors.internal.CursorExecutorImpl +import org.hisp.dhis.android.core.arch.storage.internal.InMemorySecureStore +import org.junit.AfterClass +import org.junit.BeforeClass +import org.junit.Test + +class DatabaseFromMigrationsIntegrationShould { + + companion object { + private const val DB_NAME_1 = "database-from-migrations-integration-should-1.db" + private const val DB_NAME_2 = "database-from-migrations-integration-should-2.db" + private lateinit var databaseAdapterFactory: DatabaseAdapterFactory + + private val context = InstrumentationRegistry.getInstrumentation().context + + @BeforeClass + @JvmStatic + fun setUpClass() { + deleteDatabases() + databaseAdapterFactory = DatabaseAdapterFactory.create(context, InMemorySecureStore()) + } + + @AfterClass + @JvmStatic + fun tearDownClass() { + deleteDatabases() + } + + private fun deleteDatabases() { + context.deleteDatabase(DB_NAME_1) + context.deleteDatabase(DB_NAME_2) + } + } + + @Test + fun ensure_db_from_snapshots_and_from_migrations_have_the_same_schema() { + val databaseAdapter = databaseAdapterFactory.newParentDatabaseAdapter() + + createDb(databaseAdapter, DB_NAME_1) + val schema1 = getSchema(databaseAdapter) + + DatabaseMigrationExecutor.USE_SNAPSHOT = false + + createDb(databaseAdapter, DB_NAME_2) + val schema2 = getSchema(databaseAdapter) + + databaseAdapter.close() + + val diff1 = schema1 - schema2 + val diff2 = schema2 - schema1 + + assertThat(diff1).isEmpty() + assertThat(diff2).isEmpty() + } + + private fun createDb(databaseAdapter: DatabaseAdapter, name: String) { + databaseAdapterFactory.createOrOpenDatabase(databaseAdapter, name, false) + } + + private fun getSchema(databaseAdapter: DatabaseAdapter): List { + val cursor = databaseAdapter.rawQuery("SELECT name, sql FROM sqlite_master ORDER BY name") + val list = mutableListOf() + val cursorExecutor = CursorExecutorImpl { c -> SchemaRow(c.getString(0), c.getString(1)) } + cursorExecutor.addObjectsToCollection(cursor, list) + return list.toList().map { row -> row.copy(sql = row.sql?.replace("\"", "")) } + } + + private data class SchemaRow(val name: String, val sql: String?) +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/arch/db/access/internal/DatabaseImportExportFromDatabaseAssetsMockIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/arch/db/access/internal/DatabaseImportExportFromDatabaseAssetsMockIntegrationShould.kt index 2a6b94207c..d159217e11 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/arch/db/access/internal/DatabaseImportExportFromDatabaseAssetsMockIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/arch/db/access/internal/DatabaseImportExportFromDatabaseAssetsMockIntegrationShould.kt @@ -1,45 +1,32 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.arch.db.access.internal -import androidx.test.platform.app.InstrumentationRegistry -import com.google.common.truth.Truth.assertThat -import org.hisp.dhis.android.core.D2Factory -import org.hisp.dhis.android.core.maintenance.D2Error -import org.hisp.dhis.android.core.mockwebserver.Dhis2MockServer -import org.hisp.dhis.android.core.systeminfo.SystemInfoTableInfo -import org.hisp.dhis.android.core.utils.runner.D2JunitRunner -import org.junit.After -import org.junit.AfterClass -import org.junit.BeforeClass -import org.junit.Test -import org.junit.runner.RunWith - // @RunWith(D2JunitRunner::class) class DatabaseImportExportFromDatabaseAssetsMockIntegrationShould { @@ -154,4 +141,4 @@ class DatabaseImportExportFromDatabaseAssetsMockIntegrationShould { assertThat(d2.programModule().programs().blockingCount()).isEqualTo(2) }*/ -} \ No newline at end of file +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/arch/db/access/internal/TestDatabaseImporter.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/arch/db/access/internal/TestDatabaseImporter.kt index c885049960..18ee389ee2 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/arch/db/access/internal/TestDatabaseImporter.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/arch/db/access/internal/TestDatabaseImporter.kt @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.arch.db.access.internal @@ -68,4 +68,4 @@ class TestDatabaseImporter { const val ASSETS_DB_NAME = "test-database.db" const val FILESYSTEM_DB_NAME = "test-database.db" } -} \ No newline at end of file +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/CollectionRepositoryOneMethodMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/CollectionRepositoryOneMethodMockIntegrationShould.java index 017caa5827..4299091dff 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/CollectionRepositoryOneMethodMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/CollectionRepositoryOneMethodMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.arch.repositories.collection; @@ -35,8 +35,7 @@ import org.junit.Test; import org.junit.runner.RunWith; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) public class CollectionRepositoryOneMethodMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { @@ -48,7 +47,7 @@ public class CollectionRepositoryOneMethodMockIntegrationShould extends BaseMock public void get_first_object_without_filters() { CategoryCombo combo = d2.categoryModule().categoryCombos() .one().blockingGet(); - assertThat(combo.uid(), is(BIRTH_UID)); + assertThat(combo.uid()).isEqualTo(BIRTH_UID); } @Test @@ -56,7 +55,7 @@ public void get_first_when_filter_limits_to_one_object() { CategoryCombo combo = d2.categoryModule().categoryCombos() .byName().eq("Births") .one().blockingGet(); - assertThat(combo.uid(), is(BIRTH_UID)); + assertThat(combo.uid()).isEqualTo(BIRTH_UID); } @Test @@ -64,7 +63,7 @@ public void get_first_when_filter_limits_to_other_object() { CategoryCombo combo = d2.categoryModule().categoryCombos() .byIsDefault().isTrue() .one().blockingGet(); - assertThat(combo.uid(), is(DEFAULT_UID)); + assertThat(combo.uid()).isEqualTo(DEFAULT_UID); } @Test @@ -72,15 +71,15 @@ public void get_first_when_filter_limits_to_no_objects() { CategoryCombo combo = d2.categoryModule().categoryCombos() .byName().eq("Wrong name") .one().blockingGet(); - assertThat(combo == null, is(true)); + assertThat(combo == null).isTrue(); } @Test public void get_with_all_children_returns_object_children() { CategoryCombo combo = d2.categoryModule().categoryCombos() .withCategories().withCategoryOptionCombos().one().blockingGet(); - assertThat(combo.uid(), is(BIRTH_UID)); - assertThat(combo.categories().size(), is(2)); - assertThat(CategoryComboInternalAccessor.accessCategoryOptionCombos(combo).size(), is(2)); + assertThat(combo.uid()).isEqualTo(BIRTH_UID); + assertThat(combo.categories().size()).isEqualTo(2); + assertThat(CategoryComboInternalAccessor.accessCategoryOptionCombos(combo).size()).isEqualTo(2); } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/FiltersOperatorsMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/FiltersOperatorsMockIntegrationShould.java index 7c2993af0c..815c67c1e5 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/FiltersOperatorsMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/FiltersOperatorsMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.arch.repositories.collection; @@ -43,8 +43,7 @@ import java.util.Date; import java.util.List; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) public class FiltersOperatorsMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { @@ -57,8 +56,8 @@ public void filter_string_with_eq() { ProgramStageCollectionRepository repository = d2.programModule().programStages() .byName().eq(NAME_1); List objects = repository.blockingGet(); - assertThat(objects.size(), is(1)); - assertThat(objects.get(0).name(), is(NAME_1)); + assertThat(objects.size()).isEqualTo(1); + assertThat(objects.get(0).name()).isEqualTo(NAME_1); } @Test @@ -66,7 +65,7 @@ public void filter_string_with_neq_for_non_existent() { ProgramStageCollectionRepository repository = d2.programModule().programStages() .byName().neq("Non existent"); List objects = repository.blockingGet(); - assertThat(objects.size(), is(2)); + assertThat(objects.size()).isEqualTo(2); } @Test @@ -74,8 +73,8 @@ public void filter_string_with_neq_for_non_existing() { ProgramStageCollectionRepository repository = d2.programModule().programStages() .byName().neq(NAME_1); List objects = repository.blockingGet(); - assertThat(objects.size(), is(1)); - assertThat(objects.get(0).name(), is(NAME_2)); + assertThat(objects.size()).isEqualTo(1); + assertThat(objects.get(0).name()).isEqualTo(NAME_2); } @Test @@ -83,8 +82,8 @@ public void filter_boolean_with_eq_true() { ProgramStageCollectionRepository repository = d2.programModule().programStages() .byAllowGenerateNextVisit().eq(true); List objects = repository.blockingGet(); - assertThat(objects.size(), is(1)); - assertThat(objects.get(0).name(), is(NAME_2)); + assertThat(objects.size()).isEqualTo(1); + assertThat(objects.get(0).name()).isEqualTo(NAME_2); } @Test @@ -92,8 +91,8 @@ public void filter_boolean_with_eq_false() { ProgramStageCollectionRepository repository = d2.programModule().programStages() .byAllowGenerateNextVisit().eq(false); List objects = repository.blockingGet(); - assertThat(objects.size(), is(1)); - assertThat(objects.get(0).name(), is(NAME_1)); + assertThat(objects.size()).isEqualTo(1); + assertThat(objects.get(0).name()).isEqualTo(NAME_1); } @Test @@ -101,8 +100,8 @@ public void filter_boolean_with_neq_true() { ProgramStageCollectionRepository repository = d2.programModule().programStages() .byAllowGenerateNextVisit().neq(true); List objects = repository.blockingGet(); - assertThat(objects.size(), is(1)); - assertThat(objects.get(0).name(), is(NAME_1)); + assertThat(objects.size()).isEqualTo(1); + assertThat(objects.get(0).name()).isEqualTo(NAME_1); } @Test @@ -110,8 +109,8 @@ public void filter_boolean_with_neq_false() { ProgramStageCollectionRepository repository = d2.programModule().programStages() .byAllowGenerateNextVisit().neq(false); List objects = repository.blockingGet(); - assertThat(objects.size(), is(1)); - assertThat(objects.get(0).name(), is(NAME_2)); + assertThat(objects.size()).isEqualTo(1); + assertThat(objects.get(0).name()).isEqualTo(NAME_2); } @Test @@ -119,8 +118,8 @@ public void filter_int_with_eq_0() { ProgramStageCollectionRepository repository = d2.programModule().programStages() .byMinDaysFromStart().eq(0); List objects = repository.blockingGet(); - assertThat(objects.size(), is(1)); - assertThat(objects.get(0).name(), is(NAME_1)); + assertThat(objects.size()).isEqualTo(1); + assertThat(objects.get(0).name()).isEqualTo(NAME_1); } @Test @@ -128,8 +127,8 @@ public void filter_int_with_eq_1() { ProgramStageCollectionRepository repository = d2.programModule().programStages() .byMinDaysFromStart().eq(1); List objects = repository.blockingGet(); - assertThat(objects.size(), is(1)); - assertThat(objects.get(0).name(), is(NAME_2)); + assertThat(objects.size()).isEqualTo(1); + assertThat(objects.get(0).name()).isEqualTo(NAME_2); } @Test @@ -137,8 +136,8 @@ public void filter_int_with_neq_0() { ProgramStageCollectionRepository repository = d2.programModule().programStages() .byMinDaysFromStart().neq(0); List objects = repository.blockingGet(); - assertThat(objects.size(), is(1)); - assertThat(objects.get(0).name(), is(NAME_2)); + assertThat(objects.size()).isEqualTo(1); + assertThat(objects.get(0).name()).isEqualTo(NAME_2); } @Test @@ -146,8 +145,8 @@ public void filter_int_with_neq_1() { ProgramStageCollectionRepository repository = d2.programModule().programStages() .byMinDaysFromStart().neq(1); List objects = repository.blockingGet(); - assertThat(objects.size(), is(1)); - assertThat(objects.get(0).name(), is(NAME_1)); + assertThat(objects.size()).isEqualTo(1); + assertThat(objects.get(0).name()).isEqualTo(NAME_1); } @Test @@ -155,8 +154,8 @@ public void filter_enum_with_eq() { ProgramStageCollectionRepository repository = d2.programModule().programStages() .byPeriodType().eq(PeriodType.Monthly); List objects = repository.blockingGet(); - assertThat(objects.size(), is(1)); - assertThat(objects.get(0).name(), is(NAME_1)); + assertThat(objects.size()).isEqualTo(1); + assertThat(objects.get(0).name()).isEqualTo(NAME_1); } @Test @@ -164,8 +163,8 @@ public void filter_enum_with_neq() { ProgramStageCollectionRepository repository = d2.programModule().programStages() .byPeriodType().neq(PeriodType.Monthly); List objects = repository.blockingGet(); - assertThat(objects.size(), is(1)); - assertThat(objects.get(0).name(), is(NAME_2)); + assertThat(objects.size()).isEqualTo(1); + assertThat(objects.get(0).name()).isEqualTo(NAME_2); } @Test @@ -174,8 +173,8 @@ public void filter_date_with_eq() throws ParseException { List objects = d2.programModule().programStages() .byCreated().eq(created) .blockingGet(); - assertThat(objects.size(), is(1)); - assertThat(objects.get(0).name(), is(NAME_1)); + assertThat(objects.size()).isEqualTo(1); + assertThat(objects.get(0).name()).isEqualTo(NAME_1); } @Test @@ -184,8 +183,8 @@ public void filter_date_with_neq() throws ParseException { List objects = d2.programModule().programStages() .byCreated().neq(created) .blockingGet(); - assertThat(objects.size(), is(1)); - assertThat(objects.get(0).name(), is(NAME_2)); + assertThat(objects.size()).isEqualTo(1); + assertThat(objects.get(0).name()).isEqualTo(NAME_2); } @Test @@ -193,7 +192,7 @@ public void filter_string_with_in_with_no_elements() { List objects = d2.programModule().programStages() .byName().in(Collections.emptyList()) .blockingGet(); - assertThat(objects.size(), is(0)); + assertThat(objects.size()).isEqualTo(0); } @Test @@ -201,8 +200,8 @@ public void filter_string_with_in_with_one_element() { List objects = d2.programModule().programStages() .byName().in(Collections.singletonList(NAME_1)) .blockingGet(); - assertThat(objects.size(), is(1)); - assertThat(objects.get(0).name(), is(NAME_1)); + assertThat(objects.size()).isEqualTo(1); + assertThat(objects.get(0).name()).isEqualTo(NAME_1); } @Test @@ -210,7 +209,7 @@ public void filter_string_with_in_with_two_elements() { List objects = d2.programModule().programStages() .byName().in(Arrays.asList(NAME_1, NAME_2)) .blockingGet(); - assertThat(objects.size(), is(2)); + assertThat(objects.size()).isEqualTo(2); } @Test @@ -218,7 +217,7 @@ public void filter_string_with_not_in_with_no_elements() { List objects = d2.programModule().programStages() .byName().notIn(Collections.emptyList()) .blockingGet(); - assertThat(objects.size(), is(2)); + assertThat(objects.size()).isEqualTo(2); } @Test @@ -226,8 +225,8 @@ public void filter_string_with_not_in_with_one_element() { List objects = d2.programModule().programStages() .byName().notIn(Collections.singletonList(NAME_1)) .blockingGet(); - assertThat(objects.size(), is(1)); - assertThat(objects.get(0).name(), is(NAME_2)); + assertThat(objects.size()).isEqualTo(1); + assertThat(objects.get(0).name()).isEqualTo(NAME_2); } @Test @@ -235,7 +234,7 @@ public void filter_string_with_not_in_with_two_elements() { List objects = d2.programModule().programStages() .byName().notIn(Arrays.asList(NAME_1, NAME_2)) .blockingGet(); - assertThat(objects.size(), is(0)); + assertThat(objects.size()).isEqualTo(0); } @Test @@ -243,7 +242,7 @@ public void filter_string_with_varargs_with_in_with_no_elements() { List objects = d2.programModule().programStages() .byName().in() .blockingGet(); - assertThat(objects.size(), is(0)); + assertThat(objects.size()).isEqualTo(0); } @Test @@ -251,8 +250,8 @@ public void filter_string_with_varargs_with_in_with_one_element() { List objects = d2.programModule().programStages() .byName().in(NAME_1) .blockingGet(); - assertThat(objects.size(), is(1)); - assertThat(objects.get(0).name(), is(NAME_1)); + assertThat(objects.size()).isEqualTo(1); + assertThat(objects.get(0).name()).isEqualTo(NAME_1); } @Test @@ -260,7 +259,7 @@ public void filter_string_with_varargs_with_in_with_two_elements() { List objects = d2.programModule().programStages() .byName().in(NAME_1, NAME_2) .blockingGet(); - assertThat(objects.size(), is(2)); + assertThat(objects.size()).isEqualTo(2); } @Test @@ -268,7 +267,7 @@ public void filter_string_with_varargs_with_not_in_with_no_elements() { List objects = d2.programModule().programStages() .byName().notIn() .blockingGet(); - assertThat(objects.size(), is(2)); + assertThat(objects.size()).isEqualTo(2); } @Test @@ -276,8 +275,8 @@ public void filter_string_with_varargs_with_not_in_with_one_element() { List objects = d2.programModule().programStages() .byName().notIn(NAME_1) .blockingGet(); - assertThat(objects.size(), is(1)); - assertThat(objects.get(0).name(), is(NAME_2)); + assertThat(objects.size()).isEqualTo(1); + assertThat(objects.get(0).name()).isEqualTo(NAME_2); } @Test @@ -285,7 +284,7 @@ public void filter_string_with_varargs_with_not_in_with_two_elements() { List objects = d2.programModule().programStages() .byName().notIn(NAME_1, NAME_2) .blockingGet(); - assertThat(objects.size(), is(0)); + assertThat(objects.size()).isEqualTo(0); } @Test @@ -293,7 +292,7 @@ public void filter_int_with_in_with_no_elements() { List objects = d2.programModule().programStages() .byMinDaysFromStart().in(Collections.emptyList()) .blockingGet(); - assertThat(objects.size(), is(0)); + assertThat(objects.size()).isEqualTo(0); } @Test @@ -301,8 +300,8 @@ public void filter_int_with_in_with_one_element() { List objects = d2.programModule().programStages() .byMinDaysFromStart().in(Collections.singletonList(0)) .blockingGet(); - assertThat(objects.size(), is(1)); - assertThat(objects.get(0).name(), is(NAME_1)); + assertThat(objects.size()).isEqualTo(1); + assertThat(objects.get(0).name()).isEqualTo(NAME_1); } @Test @@ -310,7 +309,7 @@ public void filter_int_with_in_with_two_elements() { List objects = d2.programModule().programStages() .byMinDaysFromStart().in(Arrays.asList(0, 1)) .blockingGet(); - assertThat(objects.size(), is(2)); + assertThat(objects.size()).isEqualTo(2); } @Test @@ -318,7 +317,7 @@ public void filter_int_with_not_in_with_no_elements() { List objects = d2.programModule().programStages() .byMinDaysFromStart().notIn(Collections.emptyList()) .blockingGet(); - assertThat(objects.size(), is(2)); + assertThat(objects.size()).isEqualTo(2); } @Test @@ -326,8 +325,8 @@ public void filter_int_with_not_in_with_one_element() { List objects = d2.programModule().programStages() .byMinDaysFromStart().notIn(Collections.singletonList(0)) .blockingGet(); - assertThat(objects.size(), is(1)); - assertThat(objects.get(0).name(), is(NAME_2)); + assertThat(objects.size()).isEqualTo(1); + assertThat(objects.get(0).name()).isEqualTo(NAME_2); } @Test @@ -335,7 +334,7 @@ public void filter_int_with_not_in_with_two_elements() { List objects = d2.programModule().programStages() .byMinDaysFromStart().notIn(Arrays.asList(0, 1)) .blockingGet(); - assertThat(objects.size(), is(0)); + assertThat(objects.size()).isEqualTo(0); } @Test @@ -343,7 +342,7 @@ public void filter_boolean_with_in_with_no_elements() { List objects = d2.programModule().programStages() .byAllowGenerateNextVisit().in(Collections.emptyList()) .blockingGet(); - assertThat(objects.size(), is(0)); + assertThat(objects.size()).isEqualTo(0); } @Test @@ -351,8 +350,8 @@ public void filter_boolean_int_with_in_with_one_element() { List objects = d2.programModule().programStages() .byAllowGenerateNextVisit().in(Collections.singletonList(false)) .blockingGet(); - assertThat(objects.size(), is(1)); - assertThat(objects.get(0).name(), is(NAME_1)); + assertThat(objects.size()).isEqualTo(1); + assertThat(objects.get(0).name()).isEqualTo(NAME_1); } @Test @@ -360,7 +359,7 @@ public void filter_boolean_int_with_in_with_two_elements() { List objects = d2.programModule().programStages() .byAllowGenerateNextVisit().in(Arrays.asList(false, true)) .blockingGet(); - assertThat(objects.size(), is(2)); + assertThat(objects.size()).isEqualTo(2); } @Test @@ -368,7 +367,7 @@ public void filter_boolean_int_with_not_in_with_no_elements() { List objects = d2.programModule().programStages() .byAllowGenerateNextVisit().notIn(Collections.emptyList()) .blockingGet(); - assertThat(objects.size(), is(2)); + assertThat(objects.size()).isEqualTo(2); } @Test @@ -376,8 +375,8 @@ public void filter_boolean_int_with_not_in_with_one_element() { List objects = d2.programModule().programStages() .byAllowGenerateNextVisit().notIn(Collections.singletonList(false)) .blockingGet(); - assertThat(objects.size(), is(1)); - assertThat(objects.get(0).name(), is(NAME_2)); + assertThat(objects.size()).isEqualTo(1); + assertThat(objects.get(0).name()).isEqualTo(NAME_2); } @Test @@ -385,7 +384,7 @@ public void filter_boolean_int_with_not_in_with_two_elements() { List objects = d2.programModule().programStages() .byAllowGenerateNextVisit().notIn(Arrays.asList(false, true)) .blockingGet(); - assertThat(objects.size(), is(0)); + assertThat(objects.size()).isEqualTo(0); } @Test @@ -393,7 +392,7 @@ public void filter_enum_with_in_with_no_elements() { List objects = d2.programModule().programStages() .byPeriodType().in(Collections.emptyList()) .blockingGet(); - assertThat(objects.size(), is(0)); + assertThat(objects.size()).isEqualTo(0); } @Test @@ -401,8 +400,8 @@ public void filter_enum_int_with_in_with_one_element() { List objects = d2.programModule().programStages() .byPeriodType().in(Collections.singletonList(PeriodType.Monthly)) .blockingGet(); - assertThat(objects.size(), is(1)); - assertThat(objects.get(0).name(), is(NAME_1)); + assertThat(objects.size()).isEqualTo(1); + assertThat(objects.get(0).name()).isEqualTo(NAME_1); } @Test @@ -410,7 +409,7 @@ public void filter_enum_int_with_in_with_two_elements() { List objects = d2.programModule().programStages() .byPeriodType().in(Arrays.asList(PeriodType.Monthly, PeriodType.Weekly)) .blockingGet(); - assertThat(objects.size(), is(2)); + assertThat(objects.size()).isEqualTo(2); } @Test @@ -418,7 +417,7 @@ public void filter_enum_int_with_not_in_with_no_elements() { List objects = d2.programModule().programStages() .byPeriodType().notIn(Collections.emptyList()) .blockingGet(); - assertThat(objects.size(), is(2)); + assertThat(objects.size()).isEqualTo(2); } @Test @@ -426,8 +425,8 @@ public void filter_enum_int_with_not_in_with_one_element() { List objects = d2.programModule().programStages() .byPeriodType().notIn(Collections.singletonList(PeriodType.Monthly)) .blockingGet(); - assertThat(objects.size(), is(1)); - assertThat(objects.get(0).name(), is(NAME_2)); + assertThat(objects.size()).isEqualTo(1); + assertThat(objects.get(0).name()).isEqualTo(NAME_2); } @Test @@ -435,7 +434,7 @@ public void filter_enum_int_with_not_in_with_two_elements() { List objects = d2.programModule().programStages() .byPeriodType().notIn(Arrays.asList(PeriodType.Monthly, PeriodType.Weekly)) .blockingGet(); - assertThat(objects.size(), is(0)); + assertThat(objects.size()).isEqualTo(0); } @Test @@ -443,7 +442,7 @@ public void filter_string_with_is_null() { ProgramStageCollectionRepository repository = d2.programModule().programStages() .byDescription().isNull(); List objects = repository.blockingGet(); - assertThat(objects.size(), is(1)); + assertThat(objects.size()).isEqualTo(1); } @Test @@ -451,7 +450,7 @@ public void filter_string_with_is_not_null() { ProgramStageCollectionRepository repository = d2.programModule().programStages() .byDescription().isNotNull(); List objects = repository.blockingGet(); - assertThat(objects.size(), is(1)); + assertThat(objects.size()).isEqualTo(1); } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/IdentifiableCollectionFiltersMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/IdentifiableCollectionFiltersMockIntegrationShould.java index 3400c5e47f..e315d792f7 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/IdentifiableCollectionFiltersMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/IdentifiableCollectionFiltersMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.arch.repositories.collection; @@ -47,8 +47,7 @@ import java.util.Date; import java.util.List; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) public class IdentifiableCollectionFiltersMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { @@ -65,8 +64,8 @@ public void find_objects_with_equal_name() { CategoryComboCollectionRepository repositoryWithUpdatedScope = d2.categoryModule().categoryCombos() .byName().eq("Births"); List combos = repositoryWithUpdatedScope.blockingGet(); - assertThat(combos.size(), is(1)); - assertThat(combos.get(0).uid(), is(BIRTH_UID)); + assertThat(combos.size()).isEqualTo(1); + assertThat(combos.get(0).uid()).isEqualTo(BIRTH_UID); } @Test @@ -75,7 +74,7 @@ public void get_objects_with_equal_name_using_one() { .byName().eq("Births") .one(); CategoryCombo combo = objectRepository.blockingGet(); - assertThat(combo.uid(), is(BIRTH_UID)); + assertThat(combo.uid()).isEqualTo(BIRTH_UID); } @Test @@ -83,9 +82,9 @@ public void find_objects_with_children_with_equal_name() { CategoryComboCollectionRepository repositoryWithUpdatedScope = d2.categoryModule().categoryCombos() .byName().eq("Births"); List combos = repositoryWithUpdatedScope.withCategories().blockingGet(); - assertThat(combos.size(), is(1)); - assertThat(combos.get(0).uid(), is(BIRTH_UID)); - assertThat(combos.get(0).categories().isEmpty(), is(false)); + assertThat(combos.size()).isEqualTo(1); + assertThat(combos.get(0).uid()).isEqualTo(BIRTH_UID); + assertThat(combos.get(0).categories().isEmpty()).isFalse(); } @Test @@ -93,8 +92,8 @@ public void find_objects_with_equal_code() { CategoryComboCollectionRepository repositoryWithUpdatedScope = d2.categoryModule().categoryCombos() .byCode().eq("BIRTHS"); List combos = repositoryWithUpdatedScope.blockingGet(); - assertThat(combos.size(), is(1)); - assertThat(combos.get(0).uid(), is(BIRTH_UID)); + assertThat(combos.size()).isEqualTo(1); + assertThat(combos.get(0).uid()).isEqualTo(BIRTH_UID); } @Test @@ -102,8 +101,8 @@ public void find_objects_with_equal_uid() { CategoryComboCollectionRepository repositoryWithUpdatedScope = d2.categoryModule().categoryCombos() .byUid().eq("m2jTvAj5kkm"); List combos = repositoryWithUpdatedScope.blockingGet(); - assertThat(combos.size(), is(1)); - assertThat(combos.get(0).uid(), is(BIRTH_UID)); + assertThat(combos.size()).isEqualTo(1); + assertThat(combos.get(0).uid()).isEqualTo(BIRTH_UID); } @Test @@ -111,8 +110,8 @@ public void find_objects_with_equal_display_name() { CategoryComboCollectionRepository repositoryWithUpdatedScope = d2.categoryModule().categoryCombos() .byDisplayName().eq("Display name with' 'single quo'tes'"); List combos = repositoryWithUpdatedScope.blockingGet(); - assertThat(combos.size(), is(1)); - assertThat(combos.get(0).uid(), is(BIRTH_UID)); + assertThat(combos.size()).isEqualTo(1); + assertThat(combos.get(0).uid()).isEqualTo(BIRTH_UID); } @Test @@ -120,7 +119,7 @@ public void do_not_find_objects_with_wrong_equal_name() { CategoryComboCollectionRepository repositoryWithUpdatedScope = d2.categoryModule().categoryCombos() .byName().eq("Deaths"); List combos = repositoryWithUpdatedScope.blockingGet(); - assertThat(combos.isEmpty(), is(true)); + assertThat(combos.isEmpty()).isTrue(); } @Test @@ -128,7 +127,7 @@ public void do_not_find_objects_with_wrong_equal_code() { CategoryComboCollectionRepository repositoryWithUpdatedScope = d2.categoryModule().categoryCombos() .byCode().eq("DEATHS"); List combos = repositoryWithUpdatedScope.blockingGet(); - assertThat(combos.isEmpty(), is(true)); + assertThat(combos.isEmpty()).isTrue(); } @Test @@ -136,8 +135,8 @@ public void find_objects_with_like_name() { CategoryComboCollectionRepository repositoryWithUpdatedScope = d2.categoryModule().categoryCombos() .byName().like("bi"); List combos = repositoryWithUpdatedScope.blockingGet(); - assertThat(combos.size(), is(1)); - assertThat(combos.get(0).uid(), is(BIRTH_UID)); + assertThat(combos.size()).isEqualTo(1); + assertThat(combos.get(0).uid()).isEqualTo(BIRTH_UID); } @Test @@ -145,8 +144,8 @@ public void find_objects_with_like_code() { CategoryComboCollectionRepository repositoryWithUpdatedScope = d2.categoryModule().categoryCombos() .byCode().like("bi"); List combos = repositoryWithUpdatedScope.blockingGet(); - assertThat(combos.size(), is(1)); - assertThat(combos.get(0).uid(), is(BIRTH_UID)); + assertThat(combos.size()).isEqualTo(1); + assertThat(combos.get(0).uid()).isEqualTo(BIRTH_UID); } @Test @@ -155,7 +154,7 @@ public void find_objects_with_equal_created() throws ParseException { CategoryComboCollectionRepository repositoryWithUpdatedScope = d2.categoryModule().categoryCombos() .byCreated().eq(created); List combos = repositoryWithUpdatedScope.blockingGet(); - assertThat(combos.size(), is(2)); + assertThat(combos.size()).isEqualTo(2); } @Test @@ -164,8 +163,8 @@ public void find_objects_with_equal_last_updated() throws ParseException { CategoryComboCollectionRepository repositoryWithUpdatedScope = d2.categoryModule().categoryCombos() .byLastUpdated().eq(created); List combos = repositoryWithUpdatedScope.blockingGet(); - assertThat(combos.size(), is(1)); - assertThat(combos.get(0).uid(), is(BIRTH_UID)); + assertThat(combos.size()).isEqualTo(1); + assertThat(combos.get(0).uid()).isEqualTo(BIRTH_UID); } @Test @@ -174,7 +173,7 @@ public void find_objects_with_last_updated_before_date_before_both() throws Pars CategoryComboCollectionRepository repositoryWithUpdatedScope = d2.categoryModule().categoryCombos() .byLastUpdated().before(created); List combos = repositoryWithUpdatedScope.blockingGet(); - assertThat(combos.size(), is(0)); + assertThat(combos.size()).isEqualTo(0); } @Test @@ -183,8 +182,8 @@ public void find_objects_with_last_updated_before_date_in_between() throws Parse CategoryComboCollectionRepository repositoryWithUpdatedScope = d2.categoryModule().categoryCombos() .byLastUpdated().before(created); List combos = repositoryWithUpdatedScope.blockingGet(); - assertThat(combos.size(), is(1)); - assertThat(combos.get(0).uid(), is(DEFAULT_UID)); + assertThat(combos.size()).isEqualTo(1); + assertThat(combos.get(0).uid()).isEqualTo(DEFAULT_UID); } @Test @@ -193,7 +192,7 @@ public void find_objects_with_last_updated_before_date_after_both() throws Parse CategoryComboCollectionRepository repositoryWithUpdatedScope = d2.categoryModule().categoryCombos() .byLastUpdated().before(created); List combos = repositoryWithUpdatedScope.blockingGet(); - assertThat(combos.size(), is(2)); + assertThat(combos.size()).isEqualTo(2); } @Test @@ -202,7 +201,7 @@ public void find_objects_with_last_updated_after_date_before_both() throws Parse CategoryComboCollectionRepository repositoryWithUpdatedScope = d2.categoryModule().categoryCombos() .byLastUpdated().after(created); List combos = repositoryWithUpdatedScope.blockingGet(); - assertThat(combos.size(), is(2)); + assertThat(combos.size()).isEqualTo(2); } @Test @@ -211,8 +210,8 @@ public void find_objects_with_last_updated_after_date_in_between() throws ParseE CategoryComboCollectionRepository repositoryWithUpdatedScope = d2.categoryModule().categoryCombos() .byLastUpdated().after(created); List combos = repositoryWithUpdatedScope.blockingGet(); - assertThat(combos.size(), is(1)); - assertThat(combos.get(0).uid(), is(BIRTH_UID)); + assertThat(combos.size()).isEqualTo(1); + assertThat(combos.get(0).uid()).isEqualTo(BIRTH_UID); } @Test @@ -221,7 +220,7 @@ public void find_objects_with_last_updated_after_date_after_both() throws ParseE CategoryComboCollectionRepository repositoryWithUpdatedScope = d2.categoryModule().categoryCombos() .byLastUpdated().after(created); List combos = repositoryWithUpdatedScope.blockingGet(); - assertThat(combos.size(), is(0)); + assertThat(combos.size()).isEqualTo(0); } @Test @@ -231,7 +230,7 @@ public void combine_date_and_string_filters() throws ParseException { .byLastUpdated().after(created) .byName().like("t"); List combos = repositoryWithUpdatedScope.blockingGet(); - assertThat(combos.size(), is(2)); + assertThat(combos.size()).isEqualTo(2); } @Test @@ -243,18 +242,18 @@ public void find_objects_with_last_updated_between_date_periods() throws ParseEx List beforeDatePeriods = Lists.newArrayList(DatePeriod.create(before, inBetween)); List beforeCategories = d2.categoryModule().categories() .byLastUpdated().inDatePeriods(beforeDatePeriods).blockingGet(); - assertThat(beforeCategories.size(), is(2)); + assertThat(beforeCategories.size()).isEqualTo(2); List afterDatePeriods = Lists.newArrayList(DatePeriod.create(inBetween, after)); List afterCategories = d2.categoryModule().categories() .byLastUpdated().inDatePeriods(afterDatePeriods).blockingGet(); - assertThat(afterCategories.size(), is(2)); + assertThat(afterCategories.size()).isEqualTo(2); List datePeriods = Lists.newArrayList(DatePeriod.create(before, inBetween), DatePeriod.create(inBetween, after)); List categories = d2.categoryModule().categories() .byLastUpdated().inDatePeriods(datePeriods).blockingGet(); - assertThat(categories.size(), is(4)); + assertThat(categories.size()).isEqualTo(4); } @Test @@ -267,6 +266,6 @@ public void find_objects_with_last_updated_between_periods() throws ParseExcepti List beforeCategories = d2.categoryModule().categories() .byLastUpdated().inPeriods(Lists.newArrayList(period)).blockingGet(); - assertThat(beforeCategories.size(), is(1)); + assertThat(beforeCategories.size()).isEqualTo(1); } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/NameableCollectionFiltersMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/NameableCollectionFiltersMockIntegrationShould.java index abe3379a54..d5c05ff743 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/NameableCollectionFiltersMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/NameableCollectionFiltersMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.arch.repositories.collection; @@ -39,8 +39,7 @@ import java.util.Date; import java.util.List; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) public class NameableCollectionFiltersMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { @@ -50,7 +49,7 @@ public void allow_filter_by_short_uid() { List categoryOptions = d2.categoryModule().categoryOptions() .byUid().eq("as6ygGvUGNg") .blockingGet(); - assertThat(categoryOptions.size(), is(1)); + assertThat(categoryOptions.size()).isEqualTo(1); } @Test @@ -58,7 +57,7 @@ public void allow_filter_by_code() { List categoryOptions = d2.categoryModule().categoryOptions() .byCode().eq("default code") .blockingGet(); - assertThat(categoryOptions.size(), is(1)); + assertThat(categoryOptions.size()).isEqualTo(1); } @Test @@ -66,7 +65,7 @@ public void allow_filter_by_name() { List categoryOptions = d2.categoryModule().categoryOptions() .byName().eq("default name") .blockingGet(); - assertThat(categoryOptions.size(), is(1)); + assertThat(categoryOptions.size()).isEqualTo(1); } @Test @@ -74,7 +73,7 @@ public void allow_filter_by_display_name() { List categoryOptions = d2.categoryModule().categoryOptions() .byDisplayName().eq("default display name") .blockingGet(); - assertThat(categoryOptions.size(), is(1)); + assertThat(categoryOptions.size()).isEqualTo(1); } @Test @@ -83,7 +82,7 @@ public void allow_filter_by_created() throws ParseException { List categoryOptions = d2.categoryModule().categoryOptions() .byCreated().eq(created) .blockingGet(); - assertThat(categoryOptions.size(), is(1)); + assertThat(categoryOptions.size()).isEqualTo(1); } @Test @@ -92,7 +91,7 @@ public void allow_filter_by_last_updated() throws ParseException { List categoryOptions = d2.categoryModule().categoryOptions() .byLastUpdated().eq(lastUpdated) .blockingGet(); - assertThat(categoryOptions.size(), is(1)); + assertThat(categoryOptions.size()).isEqualTo(1); } @Test @@ -100,7 +99,7 @@ public void allow_filter_by_short_name() { List categoryOptions = d2.categoryModule().categoryOptions() .byShortName().eq("default short name") .blockingGet(); - assertThat(categoryOptions.size(), is(1)); + assertThat(categoryOptions.size()).isEqualTo(1); } @Test @@ -108,7 +107,7 @@ public void allow_filter_by_display_short_name() { List categoryOptions = d2.categoryModule().categoryOptions() .byDisplayShortName().eq("default display short name") .blockingGet(); - assertThat(categoryOptions.size(), is(1)); + assertThat(categoryOptions.size()).isEqualTo(1); } @Test @@ -116,7 +115,7 @@ public void allow_filter_by_description() { List categoryOptions = d2.categoryModule().categoryOptions() .byDescription().eq("default description") .blockingGet(); - assertThat(categoryOptions.size(), is(1)); + assertThat(categoryOptions.size()).isEqualTo(1); } @Test @@ -124,7 +123,7 @@ public void allow_filter_by_display_description() { List categoryOptions = d2.categoryModule().categoryOptions() .byDisplayDescription().eq("default display description") .blockingGet(); - assertThat(categoryOptions.size(), is(1)); + assertThat(categoryOptions.size()).isEqualTo(1); } @Test @@ -133,7 +132,7 @@ public void allow_combination_of_identifiable_and_nameable_filter() { .byName().eq("default name") .byDisplayDescription().eq("default display description") .blockingGet(); - assertThat(categoryOptions.size(), is(1)); + assertThat(categoryOptions.size()).isEqualTo(1); } @Test @@ -142,6 +141,6 @@ public void allow_combination_of_nameable_and_identifiable_filter() { .byDisplayDescription().eq("default display description") .byName().eq("default name") .blockingGet(); - assertThat(categoryOptions.size(), is(1)); + assertThat(categoryOptions.size()).isEqualTo(1); } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/PagingMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/PagingMockIntegrationShould.java index eb6892b7d7..ade85bec89 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/PagingMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/PagingMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.arch.repositories.collection; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyCollectionRepositoryImplIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyCollectionRepositoryImplIntegrationShould.java index 5e60230541..bc7271d59e 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyCollectionRepositoryImplIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyCollectionRepositoryImplIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.arch.repositories.collection; @@ -107,20 +107,20 @@ public void get_count_with_restricted_scope() { public void get_isEmpty_with_unrestricted_scope() { boolean isEmpty = relationshipTypeCollectionRepository.blockingIsEmpty(); - assertThat(isEmpty).isEqualTo(false); + assertThat(isEmpty).isFalse(); } @Test public void get_isEmpty_with_restricted_scope() { boolean isEmpty = relationshipTypeCollectionRepository.byUid().eq(RELATIONSHIP_TYPE_UID_1).blockingIsEmpty(); - assertThat(isEmpty).isEqualTo(false); + assertThat(isEmpty).isFalse(); } @Test public void get_isEmpty_with_zero_elements_scope() { boolean isEmpty = relationshipTypeCollectionRepository.byCode().eq("non-existing").blockingIsEmpty(); - assertThat(isEmpty).isEqualTo(true); + assertThat(isEmpty).isTrue(); } } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyIdentifiableCollectionRepositoryImplIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyIdentifiableCollectionRepositoryImplIntegrationShould.java index 2824759e93..93241ea4b3 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyIdentifiableCollectionRepositoryImplIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/ReadOnlyIdentifiableCollectionRepositoryImplIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.arch.repositories.collection; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/RelationshipTypeAsserts.java b/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/RelationshipTypeAsserts.java index 8b0ee73d3c..d32a2bd244 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/RelationshipTypeAsserts.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/arch/repositories/collection/RelationshipTypeAsserts.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.arch.repositories.collection; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/arch/storage/internal/CredentialsSecureStorageMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/arch/storage/internal/CredentialsSecureStorageMockIntegrationShould.java deleted file mode 100644 index 9264e9d947..0000000000 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/arch/storage/internal/CredentialsSecureStorageMockIntegrationShould.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2004-2019, 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.arch.storage.internal; - -import androidx.test.platform.app.InstrumentationRegistry; - -import org.hisp.dhis.android.core.maintenance.D2Error; -import org.hisp.dhis.android.core.utils.runner.D2JunitRunner; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; - -import static com.google.common.truth.Truth.assertThat; - -@RunWith(D2JunitRunner.class) -public class CredentialsSecureStorageMockIntegrationShould { - - private ObjectKeyValueStore credentialsSecureStore; - - @Before - public void setUp() throws D2Error { - credentialsSecureStore = - new CredentialsSecureStoreImpl( - new AndroidSecureStore(InstrumentationRegistry.getInstrumentation().getContext())); - } - - @Test - public void credentials_are_correctly_stored() { - Credentials credentials = Credentials.create("username", "password"); - credentialsSecureStore.set(credentials); - - Credentials retrievedCredentials = credentialsSecureStore.get(); - - assertThat(retrievedCredentials.username()).isEqualTo(credentials.username()); - assertThat(retrievedCredentials.password()).isEqualTo(credentials.password()); - } - - @Test - public void credentials_are_correctly_removed() { - Credentials credentials = Credentials.create("username", "password"); - credentialsSecureStore.set(credentials); - - credentialsSecureStore.remove(); - - Credentials retrievedCredentials = credentialsSecureStore.get(); - - assertThat(retrievedCredentials).isNull(); - } - -} \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/arch/storage/internal/CredentialsSecureStorageMockIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/arch/storage/internal/CredentialsSecureStorageMockIntegrationShould.kt new file mode 100644 index 0000000000..90f029c061 --- /dev/null +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/arch/storage/internal/CredentialsSecureStorageMockIntegrationShould.kt @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2004-2021, 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.arch.storage.internal + +import androidx.test.platform.app.InstrumentationRegistry +import com.google.common.truth.Truth.assertThat +import net.openid.appauth.AuthState +import org.hisp.dhis.android.core.utils.runner.D2JunitRunner +import org.junit.Test +import org.junit.runner.RunWith + +@RunWith(D2JunitRunner::class) +class CredentialsSecureStorageMockIntegrationShould { + private fun instantiateStore(): CredentialsSecureStoreImpl = CredentialsSecureStoreImpl( + ChunkedSecureStore( + AndroidSecureStore(InstrumentationRegistry.getInstrumentation().context) + ) + ) + + @Test + fun credentials_are_correctly_stored_for_regular_password() { + setAndVerify(Credentials("username", "password", null)) + } + + @Test + fun credentials_are_correctly_stored_for_really_log_password() { + val pw = (0 until 1000).joinToString { it.toString() } + setAndVerify(Credentials("username", pw, null)) + } + + @Test + fun credentials_are_correctly_stored_for_open_id_connect_config() { + val authState = AuthState() + setAndVerify(Credentials("username", null, authState)) + } + + private fun setAndVerify(credentials: Credentials) { + val store1 = instantiateStore() + store1.set(credentials) + val extractedCredentials1 = store1.get() + assertThat(extractedCredentials1).isEqualTo(credentials) + + // Instantiating a second store ensure credentials are not retrieved from the cache + val store2 = instantiateStore() + val extractedCredentials2 = store2.get() + assertThat(extractedCredentials2).isEqualTo(credentials) + } + + @Test + fun credentials_are_correctly_removed() { + val store1 = instantiateStore() + val credentials = Credentials("username", "password", null) + store1.set(credentials) + store1.remove() + + val retrievedCredentials1 = store1.get() + assertThat(retrievedCredentials1).isNull() + + val store2 = instantiateStore() + val retrievedCredentials2 = store2.get() + assertThat(retrievedCredentials2).isNull() + } +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/attribute/internal/AttributeStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/attribute/internal/AttributeStoreIntegrationShould.java new file mode 100644 index 0000000000..3ebf933d91 --- /dev/null +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/attribute/internal/AttributeStoreIntegrationShould.java @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2004-2021, 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.attribute.internal; + +import org.hisp.dhis.android.core.attribute.Attribute; +import org.hisp.dhis.android.core.attribute.AttributeTableInfo; +import org.hisp.dhis.android.core.common.ValueType; +import org.hisp.dhis.android.core.data.attribute.AttributeSamples; +import org.hisp.dhis.android.core.data.database.IdentifiableObjectStoreAbstractIntegrationShould; +import org.hisp.dhis.android.core.data.legendset.LegendSetSamples; +import org.hisp.dhis.android.core.legendset.LegendSet; +import org.hisp.dhis.android.core.legendset.LegendSetTableInfo; +import org.hisp.dhis.android.core.legendset.internal.LegendSetStore; +import org.hisp.dhis.android.core.utils.integration.mock.TestDatabaseAdapterFactory; +import org.hisp.dhis.android.core.utils.runner.D2JunitRunner; +import org.junit.runner.RunWith; + +@RunWith(D2JunitRunner.class) +public class AttributeStoreIntegrationShould extends IdentifiableObjectStoreAbstractIntegrationShould { + + public AttributeStoreIntegrationShould() { + super(AttributeStore.create(TestDatabaseAdapterFactory.get()), AttributeTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); + } + + @Override + protected Attribute buildObject() { + return AttributeSamples.getAttribute(); + } + + @Override + protected Attribute buildObjectToUpdate() { + return AttributeSamples.getAttribute().toBuilder() + .valueType(ValueType.AGE) + .build(); + } +} \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/attribute/internal/DataElementAttributeValueLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/attribute/internal/DataElementAttributeValueLinkStoreIntegrationShould.java new file mode 100644 index 0000000000..b096f38a19 --- /dev/null +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/attribute/internal/DataElementAttributeValueLinkStoreIntegrationShould.java @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2004-2021, 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.attribute.internal; + +import org.hisp.dhis.android.core.attribute.DataElementAttributeValueLink; +import org.hisp.dhis.android.core.attribute.DataElementAttributeValueLinkTableInfo; +import org.hisp.dhis.android.core.data.attribute.DataElementAttributeValueLinkSamples; +import org.hisp.dhis.android.core.data.database.LinkStoreAbstractIntegrationShould; +import org.hisp.dhis.android.core.utils.integration.mock.TestDatabaseAdapterFactory; +import org.hisp.dhis.android.core.utils.runner.D2JunitRunner; +import org.junit.runner.RunWith; + +@RunWith(D2JunitRunner.class) +public class DataElementAttributeValueLinkStoreIntegrationShould + extends LinkStoreAbstractIntegrationShould { + + public DataElementAttributeValueLinkStoreIntegrationShould() { + super(DataElementAttributeValueLinkStore.create(TestDatabaseAdapterFactory.get()), + DataElementAttributeValueLinkTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); + } + + @Override + protected String addMasterUid() { + return DataElementAttributeValueLinkSamples.getDataElementAttribute().dataElement(); + } + + @Override + protected DataElementAttributeValueLink buildObject() { + return DataElementAttributeValueLinkSamples.getDataElementAttribute(); + } + + @Override + protected DataElementAttributeValueLink buildObjectWithOtherMasterUid() { + return buildObject().toBuilder() + .dataElement("new_data_element") + .build(); + } +} \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/attribute/internal/ProgramAttributeValueLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/attribute/internal/ProgramAttributeValueLinkStoreIntegrationShould.java new file mode 100644 index 0000000000..019e62ba20 --- /dev/null +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/attribute/internal/ProgramAttributeValueLinkStoreIntegrationShould.java @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2004-2021, 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.attribute.internal; + +import org.hisp.dhis.android.core.attribute.ProgramAttributeValueLink; +import org.hisp.dhis.android.core.attribute.ProgramAttributeValueLinkTableInfo; +import org.hisp.dhis.android.core.data.attribute.ProgramAttributeValueLinkSamples; +import org.hisp.dhis.android.core.data.database.LinkStoreAbstractIntegrationShould; +import org.hisp.dhis.android.core.utils.integration.mock.TestDatabaseAdapterFactory; +import org.hisp.dhis.android.core.utils.runner.D2JunitRunner; +import org.junit.runner.RunWith; + +@RunWith(D2JunitRunner.class) +public class ProgramAttributeValueLinkStoreIntegrationShould + extends LinkStoreAbstractIntegrationShould { + + public ProgramAttributeValueLinkStoreIntegrationShould() { + super(ProgramAttributeValueLinkStore.create(TestDatabaseAdapterFactory.get()), + ProgramAttributeValueLinkTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); + } + + @Override + protected String addMasterUid() { + return ProgramAttributeValueLinkSamples.getProgramAttribute().program(); + } + + @Override + protected ProgramAttributeValueLink buildObject() { + return ProgramAttributeValueLinkSamples.getProgramAttribute(); + } + + @Override + protected ProgramAttributeValueLink buildObjectWithOtherMasterUid() { + return buildObject().toBuilder() + .program("new_program") + .build(); + } +} \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/attribute/internal/ProgramStageAttributeValueLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/attribute/internal/ProgramStageAttributeValueLinkStoreIntegrationShould.java new file mode 100644 index 0000000000..b17a33fe00 --- /dev/null +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/attribute/internal/ProgramStageAttributeValueLinkStoreIntegrationShould.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2004-2021, 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.attribute.internal; + +import org.hisp.dhis.android.core.attribute.ProgramStageAttributeValueLink; +import org.hisp.dhis.android.core.attribute.ProgramStageAttributeValueLinkTableInfo; +import org.hisp.dhis.android.core.data.attribute.ProgramStageAttributeValueLinkSamples; +import org.hisp.dhis.android.core.data.database.LinkStoreAbstractIntegrationShould; +import org.hisp.dhis.android.core.utils.integration.mock.TestDatabaseAdapterFactory; +import org.hisp.dhis.android.core.utils.runner.D2JunitRunner; +import org.junit.runner.RunWith; + +@RunWith(D2JunitRunner.class) +public class ProgramStageAttributeValueLinkStoreIntegrationShould + extends LinkStoreAbstractIntegrationShould { + + public ProgramStageAttributeValueLinkStoreIntegrationShould() { + super(ProgramStageAttributeValueLinkStore.create(TestDatabaseAdapterFactory.get()), + ProgramStageAttributeValueLinkTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); + } + + + @Override + protected String addMasterUid() { + return ProgramStageAttributeValueLinkSamples.getProgramStageAttribute().programStage(); + } + + @Override + protected ProgramStageAttributeValueLink buildObject() { + return ProgramStageAttributeValueLinkSamples.getProgramStageAttribute(); + } + + @Override + protected ProgramStageAttributeValueLink buildObjectWithOtherMasterUid() { + return buildObject().toBuilder() + .programStage("new_program_stage") + .build(); + } +} \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryComboLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryComboLinkStoreIntegrationShould.java index f5561a1003..c85c4728fb 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryComboLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryComboLinkStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.category.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryOptionLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryOptionLinkStoreIntegrationShould.java index 97f4c18bd5..c3c50da80d 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryOptionLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryCategoryOptionLinkStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.category.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryComboEndpointCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryComboEndpointCallRealIntegrationShould.java index 97d0bf9162..12c1c6bc91 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryComboEndpointCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryComboEndpointCallRealIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.category.internal; @@ -47,8 +47,7 @@ import io.reactivex.Single; -import static junit.framework.Assert.assertFalse; -import static junit.framework.Assert.assertTrue; +import static com.google.common.truth.Truth.assertThat; public class CategoryComboEndpointCallRealIntegrationShould extends BaseRealIntegrationTest { @@ -68,14 +67,14 @@ public void download_categories_combos_and_relatives() { d2.databaseAdapter().setForeignKeyConstraintsEnabled(false); assertNotCombosInDB(); - assertTrue(getCategoryCategoryComboLinks().isEmpty()); + assertThat(getCategoryCategoryComboLinks().isEmpty()).isTrue(); Single> categoryComboEndpointCall = getD2DIComponent(d2).internalModules().category.categoryComboCall.download( new HashSet<>(Lists.newArrayList("bjDvmb4bfuf"))); List categoryCombos = categoryComboEndpointCall.blockingGet(); - assertFalse(categoryCombos.isEmpty()); + assertThat(categoryCombos.isEmpty()).isFalse(); downloadCategories(); @@ -84,7 +83,7 @@ public void download_categories_combos_and_relatives() { private void assertDataIsProperlyParsedAndInsertedInTheDB() { assertThereAreCombosInDB(); - assertFalse(getCategoryCategoryComboLinks().isEmpty()); + assertThat(getCategoryCategoryComboLinks().isEmpty()).isFalse(); assertThereAreCategoryOptionCombosInDB(); assertThereAreCategoriesInDB(); } @@ -97,13 +96,13 @@ private void downloadCategories() { private void assertNotCombosInDB() { IdentifiableObjectStore categoryComboStore = CategoryComboStore.create(d2.databaseAdapter()); List categoryCombos = categoryComboStore.selectAll(); - assertTrue(categoryCombos.isEmpty()); + assertThat(categoryCombos.isEmpty()).isTrue(); } private void assertThereAreCombosInDB() { IdentifiableObjectStore categoryComboStore = CategoryComboStore.create(d2.databaseAdapter()); List categoryCombos = categoryComboStore.selectAll(); - assertTrue(categoryCombos.size() > 0); + assertThat(categoryCombos.size() > 0).isTrue(); } private List getCategoryCategoryComboLinks() { @@ -115,12 +114,12 @@ private List getCategoryCategoryComboLinks() { private void assertThereAreCategoryOptionCombosInDB() { IdentifiableObjectStore categoryOptionComboStore = CategoryOptionComboStoreImpl.create(d2.databaseAdapter()); List categoryOptionCombos = categoryOptionComboStore.selectAll(); - assertTrue(categoryOptionCombos.size() > 0); + assertThat(categoryOptionCombos.size() > 0).isTrue(); } private void assertThereAreCategoriesInDB() { IdentifiableObjectStore categoryOptionStore = CategoryOptionStore.create(d2.databaseAdapter()); List categoryOptionUids = categoryOptionStore.selectUids(); - assertTrue(categoryOptionUids.size() > 0); + assertThat(categoryOptionUids.size() > 0).isTrue(); } } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryComboUidsSeekerMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryComboUidsSeekerMockIntegrationShould.java index a896b9f090..7795d745e7 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryComboUidsSeekerMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryComboUidsSeekerMockIntegrationShould.java @@ -1,34 +1,33 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.category.internal; -import org.hisp.dhis.android.core.category.internal.CategoryComboUidsSeeker; import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestFullDispatcher; import org.hisp.dhis.android.core.utils.runner.D2JunitRunner; import org.junit.Test; @@ -36,8 +35,7 @@ import java.util.Set; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) public class CategoryComboUidsSeekerMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { @@ -46,9 +44,9 @@ public class CategoryComboUidsSeekerMockIntegrationShould extends BaseMockIntegr public void seek_category_combos_uids() { Set categories = new CategoryComboUidsSeeker(databaseAdapter).seekUids(); - assertThat(categories.size(), is(2)); - assertThat(categories.contains("m2jTvAj5kkm"), is(true)); + assertThat(categories.size()).isEqualTo(2); + assertThat(categories.contains("m2jTvAj5kkm")).isTrue(); // Default category combo (p0KPaWEg3cf). - assertThat(categories.contains("p0KPaWEg3cf"), is(true)); + assertThat(categories.contains("p0KPaWEg3cf")).isTrue(); } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryEndpointCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryEndpointCallRealIntegrationShould.java index 5575457b60..99db0af879 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryEndpointCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryEndpointCallRealIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.category.internal; @@ -42,7 +42,7 @@ import io.reactivex.Single; -import static junit.framework.Assert.assertFalse; +import static com.google.common.truth.Truth.assertThat; public class CategoryEndpointCallRealIntegrationShould extends BaseRealIntegrationTest { @@ -63,6 +63,6 @@ public void call_categories_endpoint() throws Exception { new HashSet<>(Lists.newArrayList("cX5k9anHEHd"))); List categories = categoryEndpointCall.blockingGet(); - assertFalse(categories.isEmpty()); + assertThat(categories.isEmpty()).isFalse(); } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryEndpointCallShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryEndpointCallShould.java index 0968751645..7635135525 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryEndpointCallShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryEndpointCallShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.category.internal; @@ -39,7 +39,7 @@ import io.reactivex.Single; -import static junit.framework.Assert.assertFalse; +import static com.google.common.truth.Truth.assertThat; public class CategoryEndpointCallShould extends BaseMockIntegrationTestEmptyEnqueable { @@ -52,6 +52,6 @@ public void download_category_successfully() { dhis2MockServer.enqueueMockResponse("category/categories.json"); List categories = categoriesSingle.blockingGet(); - assertFalse(categories.isEmpty()); + assertThat(categories.isEmpty()).isFalse(); } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryOptionComboCategoryOptionLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryOptionComboCategoryOptionLinkStoreIntegrationShould.java index 25523a6113..c7abdcdd4e 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryOptionComboCategoryOptionLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CategoryOptionComboCategoryOptionLinkStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.category.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CreateCategoryComboUtils.java b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CreateCategoryComboUtils.java index 324f12648a..49f17a375a 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CreateCategoryComboUtils.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/category/internal/CreateCategoryComboUtils.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.category.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/common/IdentifiableObjectStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/common/IdentifiableObjectStoreIntegrationShould.java index 6dc918b00b..9600b3a47a 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/common/IdentifiableObjectStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/common/IdentifiableObjectStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.common; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/common/ObjectStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/common/ObjectStoreIntegrationShould.java index 8d833a68e2..7872cba709 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/common/ObjectStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/common/ObjectStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.common; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/common/StoreMocks.java b/core/src/androidTest/java/org/hisp/dhis/android/core/common/StoreMocks.java index e1a2926b9b..a4c53e3e3d 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/common/StoreMocks.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/common/StoreMocks.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.common; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/common/ValueTypeDeviceRenderingStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/common/ValueTypeDeviceRenderingStoreIntegrationShould.java index 5c997470f8..d0002d4b08 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/common/ValueTypeDeviceRenderingStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/common/ValueTypeDeviceRenderingStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.common; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/common/internal/DataStatePropagatorIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/common/internal/DataStatePropagatorIntegrationShould.java index 175a3d1111..c2d1e6e51c 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/common/internal/DataStatePropagatorIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/common/internal/DataStatePropagatorIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.common.internal; @@ -57,8 +57,6 @@ import java.text.ParseException; import java.util.Date; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; import static com.google.common.truth.Truth.assertThat; @RunWith(AndroidJUnit4.class) @@ -119,7 +117,7 @@ public void do_not_set_parent_state_to_update_if_has_to_post_state() throws D2Er public void do_not_fail_with_events_without_registration() throws D2Error { String eventUid = d2.eventModule().events().blockingAdd(sampleEventProjection(null)); - assertThat(eventStore.selectByUid(eventUid).state(), is(State.TO_POST)); + assertThat(eventStore.selectByUid(eventUid).state()).isEqualTo(State.TO_POST); eventStore.delete(eventUid); } @@ -138,12 +136,12 @@ public void reset_enrollment_and_event_states_if_uploading() throws D2Error { propagator.resetUploadingEnrollmentAndEventStates(teiUid); - assertThat(enrollmentStore.getState(enrolmentUid1), is(State.TO_UPDATE)); - assertThat(enrollmentStore.getState(enrolmentUid2), is(State.TO_POST)); + assertThat(enrollmentStore.getState(enrolmentUid1)).isEqualTo(State.TO_UPDATE); + assertThat(enrollmentStore.getState(enrolmentUid2)).isEqualTo(State.TO_POST); - assertThat(eventStore.getState(eventUid1), is(State.TO_UPDATE)); - assertThat(eventStore.getState(eventUid2), is(State.TO_POST)); - assertThat(eventStore.getState(eventUid3), is(State.TO_POST)); + assertThat(eventStore.getState(eventUid1)).isEqualTo(State.TO_UPDATE); + assertThat(eventStore.getState(eventUid2)).isEqualTo(State.TO_POST); + assertThat(eventStore.getState(eventUid3)).isEqualTo(State.TO_POST); trackedEntityInstanceStore.delete(teiUid); } @@ -187,7 +185,7 @@ public void propagate_tei_relationship_update() throws D2Error { propagator.propagateRelationshipUpdate(fromItem); - assertThat(trackedEntityInstanceStore.selectByUid(teiUid).state(), is(State.TO_UPDATE)); + assertThat(trackedEntityInstanceStore.selectByUid(teiUid).state()).isEqualTo(State.TO_UPDATE); trackedEntityInstanceStore.delete(teiUid); } @@ -200,8 +198,8 @@ public void propagate_enrollment_relationship_update() throws D2Error { propagator.propagateRelationshipUpdate(fromItem); - assertThat(trackedEntityInstanceStore.selectByUid(teiUid).state(), is(State.TO_UPDATE)); - assertThat(enrollmentStore.selectByUid(enrollmentUid).state(), is(State.TO_UPDATE)); + assertThat(trackedEntityInstanceStore.selectByUid(teiUid).state()).isEqualTo(State.TO_UPDATE); + assertThat(enrollmentStore.selectByUid(enrollmentUid).state()).isEqualTo(State.TO_UPDATE); trackedEntityInstanceStore.delete(teiUid); } @@ -215,9 +213,9 @@ public void propagate_event_relationship_update() throws D2Error { propagator.propagateRelationshipUpdate(fromItem); - assertThat(trackedEntityInstanceStore.selectByUid(teiUid).state(), is(State.TO_UPDATE)); - assertThat(enrollmentStore.selectByUid(enrollmentUid).state(), is(State.TO_UPDATE)); - assertThat(eventStore.selectByUid(eventUid).state(), is(State.TO_UPDATE)); + assertThat(trackedEntityInstanceStore.selectByUid(teiUid).state()).isEqualTo(State.TO_UPDATE); + assertThat(enrollmentStore.selectByUid(enrollmentUid).state()).isEqualTo(State.TO_UPDATE); + assertThat(eventStore.selectByUid(eventUid).state()).isEqualTo(State.TO_UPDATE); trackedEntityInstanceStore.delete(teiUid); } @@ -227,7 +225,7 @@ private void assertThatSetTeiToUpdateWhenEnrollmentPropagation(State state) thro propagator.propagateEnrollmentUpdate(Enrollment.builder().uid("uid").trackedEntityInstance(teiUid).build()); - assertThat(trackedEntityInstanceStore.selectByUid(teiUid).state(), is(State.TO_UPDATE)); + assertThat(trackedEntityInstanceStore.selectByUid(teiUid).state()).isEqualTo(State.TO_UPDATE); trackedEntityInstanceStore.delete(teiUid); } @@ -236,7 +234,7 @@ private void assertThatDoNotSetTeiToUpdateWhenEnrollmentPropagation(State state) propagator.propagateEnrollmentUpdate(Enrollment.builder().uid("uid").trackedEntityInstance(teiUid).build()); - assertThat(trackedEntityInstanceStore.selectByUid(teiUid).state(), is(state)); + assertThat(trackedEntityInstanceStore.selectByUid(teiUid).state()).isEqualTo(state); trackedEntityInstanceStore.delete(teiUid); } @@ -248,8 +246,8 @@ private void assertThatSetTeiToUpdateWhenEventPropagation(State state) throws D2 propagator.propagateEventUpdate(Event.builder().uid("uid").enrollment(enrolmentUid).build()); - assertThat(trackedEntityInstanceStore.selectByUid(teiUid).state(), is(State.TO_UPDATE)); - assertThat(enrollmentStore.selectByUid(enrolmentUid).state(), is(State.TO_UPDATE)); + assertThat(trackedEntityInstanceStore.selectByUid(teiUid).state()).isEqualTo(State.TO_UPDATE); + assertThat(enrollmentStore.selectByUid(enrolmentUid).state()).isEqualTo(State.TO_UPDATE); trackedEntityInstanceStore.delete(teiUid); } @@ -259,8 +257,8 @@ private void assertThatDoNotSetTeiToUpdateWhenEventPropagation(State state) thro propagator.propagateEventUpdate(Event.builder().uid("uid").enrollment(enrolmentUid).build()); - assertThat(trackedEntityInstanceStore.selectByUid(teiUid).state(), is(state)); - assertThat(enrollmentStore.selectByUid(enrolmentUid).state(), is(state)); + assertThat(trackedEntityInstanceStore.selectByUid(teiUid).state()).isEqualTo(state); + assertThat(enrollmentStore.selectByUid(enrolmentUid).state()).isEqualTo(state); trackedEntityInstanceStore.delete(teiUid); } @@ -271,9 +269,9 @@ private void assertThatSetTeiToUpdateWhenTrackedEntityDataValuePropagation(State propagator.propagateTrackedEntityDataValueUpdate(TrackedEntityDataValue.builder().event(eventUid).build()); - assertThat(trackedEntityInstanceStore.selectByUid(teiUid).state(), is(State.TO_UPDATE)); - assertThat(enrollmentStore.selectByUid(enrolmentUid).state(), is(State.TO_UPDATE)); - assertThat(eventStore.selectByUid(eventUid).state(), is(State.TO_UPDATE)); + assertThat(trackedEntityInstanceStore.selectByUid(teiUid).state()).isEqualTo(State.TO_UPDATE); + assertThat(enrollmentStore.selectByUid(enrolmentUid).state()).isEqualTo(State.TO_UPDATE); + assertThat(eventStore.selectByUid(eventUid).state()).isEqualTo(State.TO_UPDATE); trackedEntityInstanceStore.delete(teiUid); } @@ -284,9 +282,9 @@ private void assertThatDoNotSetTeiToUpdateWhenTrackedEntityDataValuePropagation( propagator.propagateTrackedEntityDataValueUpdate(TrackedEntityDataValue.builder().event(eventUid).build()); - assertThat(trackedEntityInstanceStore.selectByUid(teiUid).state(), is(state)); - assertThat(enrollmentStore.selectByUid(enrolmentUid).state(), is(state)); - assertThat(eventStore.selectByUid(eventUid).state(), is(state)); + assertThat(trackedEntityInstanceStore.selectByUid(teiUid).state()).isEqualTo(state); + assertThat(enrollmentStore.selectByUid(enrolmentUid).state()).isEqualTo(state); + assertThat(eventStore.selectByUid(eventUid).state()).isEqualTo(state); trackedEntityInstanceStore.delete(teiUid); } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/configuration/internal/ConfigurationStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/configuration/internal/ConfigurationStoreIntegrationShould.java index bb4245ca73..1300a883ca 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/configuration/internal/ConfigurationStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/configuration/internal/ConfigurationStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.configuration.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/configuration/internal/DatabaseConfigurationMigrationIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/configuration/internal/DatabaseConfigurationMigrationIntegrationShould.java index 47423be195..9114a11c7d 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/configuration/internal/DatabaseConfigurationMigrationIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/configuration/internal/DatabaseConfigurationMigrationIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.configuration.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/constant/internal/ConstantStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/constant/internal/ConstantStoreIntegrationShould.java index 53f0fad89f..01a9870536 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/constant/internal/ConstantStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/constant/internal/ConstantStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.constant.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/CursorAssert.java b/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/CursorAssert.java index 68d862cd25..21b881dfda 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/CursorAssert.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/CursorAssert.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.data.database; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/DatabaseAssert.java b/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/DatabaseAssert.java deleted file mode 100644 index b7c767b703..0000000000 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/DatabaseAssert.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2004-2019, 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.data.database; - -import android.database.Cursor; - -import org.hisp.dhis.android.core.arch.db.access.DatabaseAdapter; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; - -public final class DatabaseAssert { - - DatabaseAdapter databaseAdapter; - - public static DatabaseAssert assertThatDatabase(DatabaseAdapter databaseAdapter) { - return new DatabaseAssert(databaseAdapter); - } - - private DatabaseAssert(DatabaseAdapter databaseAdapter) { - this.databaseAdapter = databaseAdapter; - } - - public DatabaseAssert isEmpty() { - verifyEmptyDatabase(true); - - return this; - } - - public DatabaseAssert isNotEmpty() { - verifyEmptyDatabase(false); - - return this; - } - - public DatabaseAssert isEmptyTable(String tableName) { - assertThat(tableCount(tableName) == 0, is(true)); - - return this; - } - - public DatabaseAssert isNotEmptyTable(String tableName) { - assertThat(tableCount(tableName) == 0, is(false)); - - return this; - } - - private void verifyEmptyDatabase(boolean expectedEmpty) { - boolean isEmpty = true; - - Cursor cursor = databaseAdapter.rawQuery(" SELECT name FROM sqlite_master " - + "WHERE type='table' and name!='android_metadata' and name!='sqlite_sequence'"); - int value = cursor.getColumnIndex("name"); - if (value != -1) { - while (cursor.moveToNext()) { - String tableName = cursor.getString(value); - - if (tableCount(tableName) > 0) { - isEmpty = false; - if (expectedEmpty) { - break; - } - } - } - } - cursor.close(); - assertThat(isEmpty, is(expectedEmpty)); - } - - private int tableCount(String tableName) { - Cursor cursor = null; - int count; - - try { - cursor = databaseAdapter.rawQuery("SELECT COUNT(*) from " + tableName); - cursor.moveToFirst(); - count = cursor.getInt(0); - } finally { - if (cursor != null) { - cursor.close(); - } - } - - cursor.close(); - return count; - } -} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/DatabaseAssert.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/DatabaseAssert.kt new file mode 100644 index 0000000000..66bb708e59 --- /dev/null +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/DatabaseAssert.kt @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2004-2021, 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.data.database + +import com.google.common.truth.Truth.assertThat +import org.hisp.dhis.android.core.arch.db.access.DatabaseAdapter +import org.junit.Assert.fail + +class DatabaseAssert private constructor(var databaseAdapter: DatabaseAdapter) { + + val isEmpty: DatabaseAssert + get() { + tablesCount().forEach { + if (it.count > 0) { fail("Table ${it.tableName} is not empty") } + } + return this + } + + val isNotEmpty: DatabaseAssert + get() { + assertThat(tablesCount().any { c -> c.count > 0 }).isTrue() + return this + } + + val isFull: DatabaseAssert + get() { + tablesCount().forEach { + if (it.count <= 0) { fail("Table ${it.tableName} is empty") } + } + return this + } + + fun isEmptyTable(tableName: String): DatabaseAssert { + assertThat(tableCount(tableName) == 0).isTrue() + return this + } + + fun isNotEmptyTable(tableName: String): DatabaseAssert { + assertThat(tableCount(tableName) == 0).isFalse() + return this + } + + private fun tablesCount(): List { + val excludedTables = listOf("android_metadata", "sqlite_sequence", "Configuration") + + val cursor = databaseAdapter.rawQuery( + " SELECT name FROM sqlite_master WHERE type='table' and " + + excludedTables.joinToString(" and ") { "name != '$it'" } + ) + + val tablesCount = ArrayList() + cursor.use { c -> + val value = cursor.getColumnIndex("name") + if (value != -1 && c.count > 0) { + c.moveToFirst() + do { + val tableName = cursor.getString(value) + val count = tableCount(tableName) + + tablesCount.add(TableCount(tableName, count)) + } while (c.moveToNext()) + } + } + return tablesCount + } + + private fun tableCount(tableName: String): Int { + val cursor = databaseAdapter.rawQuery("SELECT COUNT(*) from $tableName") + + return cursor.use { c -> + if (c.count >= 1) { + c.moveToFirst() + cursor.getInt(0) + } else { + 0 + } + } + } + + companion object { + @JvmStatic + fun assertThatDatabase(databaseAdapter: DatabaseAdapter): DatabaseAssert { + return DatabaseAssert(databaseAdapter) + } + } + + data class TableCount(val tableName: String, val count: Int) +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/DbTestUtils.java b/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/DbTestUtils.java index 8c2711e682..6284f5a2da 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/DbTestUtils.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/DbTestUtils.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.data.database; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/IdentifiableDataObjectStoreAbstractIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/IdentifiableDataObjectStoreAbstractIntegrationShould.java index 322392c821..dbafb0fd21 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/IdentifiableDataObjectStoreAbstractIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/IdentifiableDataObjectStoreAbstractIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.data.database; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/IdentifiableObjectStoreAbstractIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/IdentifiableObjectStoreAbstractIntegrationShould.java index 11a0b567c2..f215023702 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/IdentifiableObjectStoreAbstractIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/IdentifiableObjectStoreAbstractIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.data.database; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/LinkStoreAbstractIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/LinkStoreAbstractIntegrationShould.java index 98c6342e18..32716b4db6 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/LinkStoreAbstractIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/LinkStoreAbstractIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.data.database; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/ObjectStoreAbstractIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/ObjectStoreAbstractIntegrationShould.java index 0564058025..30687bce89 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/ObjectStoreAbstractIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/ObjectStoreAbstractIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.data.database; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/ObjectWithoutUidStoreAbstractIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/ObjectWithoutUidStoreAbstractIntegrationShould.java index ce6f67c383..91314bd4e3 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/ObjectWithoutUidStoreAbstractIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/ObjectWithoutUidStoreAbstractIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.data.database; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/migrations/DataBaseMigrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/migrations/DataBaseMigrationShould.java index 52093a4f87..c5f32bcc01 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/migrations/DataBaseMigrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/data/database/migrations/DataBaseMigrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.data.database.migrations; @@ -43,9 +43,8 @@ import org.junit.Test; import org.junit.runner.RunWith; -import static org.hamcrest.CoreMatchers.is; +import static com.google.common.truth.Truth.assertThat; import static org.hisp.dhis.android.core.arch.db.access.SqliteCheckerUtility.ifTableExist; -import static org.junit.Assert.assertThat; @RunWith(AndroidJUnit4.class) public class DataBaseMigrationShould { @@ -74,19 +73,19 @@ private void closeAndDeleteDatabase() { @Test public void have_user_table_after_migration_1() { initCoreDataBase(1); - assertThat(ifTableExist(UserTableInfo.TABLE_INFO.name(), databaseAdapter), is(true)); + assertThat(ifTableExist(UserTableInfo.TABLE_INFO.name(), databaseAdapter)).isTrue(); } @Test public void not_have_tracked_entity_attribute_reserved_value_table_after_migration_1() { initCoreDataBase(1); - assertThat(ifTableExist(TrackedEntityAttributeReservedValueTableInfo.TABLE_INFO.name(), databaseAdapter), is(false)); + assertThat(ifTableExist(TrackedEntityAttributeReservedValueTableInfo.TABLE_INFO.name(), databaseAdapter)).isFalse(); } @Test public void have_tracked_entity_attribute_reserved_value_table_after_first_migration_2() { initCoreDataBase(2); - assertThat(ifTableExist(TrackedEntityAttributeReservedValueTableInfo.TABLE_INFO.name(), databaseAdapter), is(true)); + assertThat(ifTableExist(TrackedEntityAttributeReservedValueTableInfo.TABLE_INFO.name(), databaseAdapter)).isTrue(); } public DatabaseAdapter initCoreDataBase(int databaseVersion) { diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/data/server/RealServerMother.java b/core/src/androidTest/java/org/hisp/dhis/android/core/data/server/RealServerMother.java index 6355aeac50..20e95a4f24 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/data/server/RealServerMother.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/data/server/RealServerMother.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.data.server; @@ -35,6 +35,7 @@ public class RealServerMother { public static String url2_32 = "https://play.dhis2.org/2.32.6/"; public static String url2_33 = "https://play.dhis2.org/2.33.6/"; public static String url2_34 = "https://play.dhis2.org/2.34.1/"; + public static String url2_35 = "https://play.dhis2.org/2.35/"; public static String url_dev = "https://play.dhis2.org/dev/"; public static String android_current = "https://play.dhis2.org/android-current/"; public static String android_previous1 = "https://play.dhis2.org/android-previous1/"; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/CreateDataElementUtils.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/CreateDataElementUtils.java index 37c92423f7..fbce0147cf 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/CreateDataElementUtils.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/CreateDataElementUtils.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.dataelement; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/internal/DataElementEndpointCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/internal/DataElementEndpointCallRealIntegrationShould.java index a0895f0aab..52c0fac2e7 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/internal/DataElementEndpointCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/internal/DataElementEndpointCallRealIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.dataelement.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/internal/DataElementOperandStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/internal/DataElementOperandStoreIntegrationShould.java index 8273ee399c..1fd4f35442 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/internal/DataElementOperandStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/internal/DataElementOperandStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.dataelement.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/internal/DataElementStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/internal/DataElementStoreIntegrationShould.java index a532d11210..4b2602cee6 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/internal/DataElementStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataelement/internal/DataElementStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.dataelement.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataInputPeriodLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataInputPeriodLinkStoreIntegrationShould.java index 79c1c1f90f..3abaf37b7f 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataInputPeriodLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataInputPeriodLinkStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.dataset.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationCallRealIntegrationShould.java index 288b886f2c..48c7880a1a 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationCallRealIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.dataset.internal; @@ -51,10 +51,10 @@ public void setUp() throws IOException { public void remove_records_deleted_in_the_server() { d2.userModule().logIn(username, password, url).blockingGet(); d2.metadataModule().blockingDownload(); - d2.aggregatedModule().data().download().blockingSubscribe(); + d2.aggregatedModule().data().blockingDownload(); // At this point, delete a record in the server - d2.aggregatedModule().data().download().blockingSubscribe(); + d2.aggregatedModule().data().blockingDownload(); } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCallRealIntegrationShould.java index 7b8a44cd47..a4dfea2c65 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompleteRegistrationPostCallRealIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.dataset.internal; @@ -64,7 +64,7 @@ public void setUp() throws IOException { public void upload_data_set_complete_registrations_with_to_post_state() throws Exception { d2.userModule().logIn(username, password, url).blockingGet(); d2.metadataModule().blockingDownload(); - d2.aggregatedModule().data().download().subscribe(); + d2.aggregatedModule().data().blockingDownload(); DataSetCompleteRegistration dataSetCompleteRegistration = getTestDataSetCompleteRegistrationWith(State.TO_POST, "2018"); @@ -90,7 +90,7 @@ public void upload_data_set_complete_registrations_with_to_post_state() throws E public void upload_data_set_complete_registrations_with_to_update_state() throws Exception { d2.userModule().logIn(username, password, url).blockingGet(); d2.metadataModule().blockingDownload(); - d2.aggregatedModule().data().download().subscribe(); + d2.aggregatedModule().data().blockingDownload(); DataSetCompleteRegistration dataSetCompleteRegistration = getTestDataSetCompleteRegistrationWith(State.TO_UPDATE, "2018"); @@ -110,7 +110,7 @@ public void upload_data_set_complete_registrations_with_to_update_state() throws public void update_and_delete_different_data_set_complete_registrations() throws Exception { d2.userModule().logIn(username, password, url).blockingGet(); d2.metadataModule().blockingDownload(); - d2.aggregatedModule().data().download().subscribe(); + d2.aggregatedModule().data().blockingDownload(); DataSetCompleteRegistration toDeleteDataSetCompleteRegistration = getTestDataSetCompleteRegistrationWith(State.TO_UPDATE, "2019"); @@ -143,7 +143,7 @@ public void update_and_delete_different_data_set_complete_registrations() throws public void delete_data_set_complete_registrations_with_to_delete_state() throws Exception { d2.userModule().logIn(username, password, url).blockingGet(); d2.metadataModule().blockingDownload(); - d2.aggregatedModule().data().download().subscribe(); + d2.aggregatedModule().data().blockingDownload(); DataSetCompleteRegistration dataSetCompleteRegistration = getTestDataSetCompleteRegistrationWith(State.TO_UPDATE, "2018"); diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompulsoryDataElementOperandLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompulsoryDataElementOperandLinkStoreIntegrationShould.java index 3216c0a958..381390a007 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompulsoryDataElementOperandLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetCompulsoryDataElementOperandLinkStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.dataset.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetDataElementLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetDataElementLinkStoreIntegrationShould.java index e9c7e37eee..cef6ebfed5 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetDataElementLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetDataElementLinkStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.dataset.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetEndpointCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetEndpointCallRealIntegrationShould.java index 0134379fae..7365beea68 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetEndpointCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetEndpointCallRealIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.dataset.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetOrganisationUnitLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetOrganisationUnitLinkStoreIntegrationShould.java index 713aca968e..9d8e4f7f11 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetOrganisationUnitLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetOrganisationUnitLinkStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.dataset.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetStoreIntegrationShould.java index f8852ee05d..3a3a33fcdb 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/DataSetStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.dataset.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/SectionDataElementLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/SectionDataElementLinkStoreIntegrationShould.java index 17e15d0a03..2498076002 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/SectionDataElementLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/SectionDataElementLinkStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.dataset.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/SectionGreyedFieldsLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/SectionGreyedFieldsLinkStoreIntegrationShould.java index 4237f0f758..c4617e18d4 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/SectionGreyedFieldsLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/SectionGreyedFieldsLinkStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.dataset.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/SectionIndicatorLinkStoreIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/SectionIndicatorLinkStoreIntegrationShould.kt new file mode 100644 index 0000000000..87017d1fd4 --- /dev/null +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/SectionIndicatorLinkStoreIntegrationShould.kt @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2004-2021, 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.dataset.internal + +import org.hisp.dhis.android.core.data.database.LinkStoreAbstractIntegrationShould +import org.hisp.dhis.android.core.data.dataset.SectionIndicatorLinkSamples +import org.hisp.dhis.android.core.dataset.SectionIndicatorLinkTableInfo +import org.hisp.dhis.android.core.dataset.internal.SectionIndicatorLinkStore.create +import org.hisp.dhis.android.core.utils.integration.mock.TestDatabaseAdapterFactory +import org.hisp.dhis.android.core.utils.runner.D2JunitRunner +import org.junit.runner.RunWith + +@RunWith(D2JunitRunner::class) +class SectionIndicatorLinkStoreIntegrationShould : LinkStoreAbstractIntegrationShould( + create(TestDatabaseAdapterFactory.get()), + SectionIndicatorLinkTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get() +) { + + override fun addMasterUid(): String { + return SectionIndicatorLinkSamples.getSectionIndicatorLink().section()!! + } + + override fun buildObject(): SectionIndicatorLink { + return SectionIndicatorLinkSamples.getSectionIndicatorLink() + } + + override fun buildObjectWithOtherMasterUid(): SectionIndicatorLink { + return buildObject().toBuilder() + .section("new_section") + .build() + } +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/SectionStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/SectionStoreIntegrationShould.java index 0ca30c74b3..590605c969 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/SectionStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/dataset/internal/SectionStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.dataset.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/internal/DataValueEndpointCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/internal/DataValueEndpointCallRealIntegrationShould.java index a0b9353722..9a6b8151e7 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/internal/DataValueEndpointCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/internal/DataValueEndpointCallRealIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.datavalue.internal; @@ -31,19 +31,21 @@ import org.hisp.dhis.android.core.BaseRealIntegrationTest; import org.hisp.dhis.android.core.D2; import org.hisp.dhis.android.core.D2Factory; -import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutor; -import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutorImpl; +import org.hisp.dhis.android.core.arch.api.executors.internal.APIDownloader; +import org.hisp.dhis.android.core.arch.api.executors.internal.APIDownloaderImpl; import org.hisp.dhis.android.core.arch.handlers.internal.Handler; import org.hisp.dhis.android.core.arch.handlers.internal.ObjectWithoutUidHandlerImpl; import org.hisp.dhis.android.core.datavalue.DataValue; import org.hisp.dhis.android.core.domain.aggregated.data.internal.AggregatedDataCallBundle; import org.hisp.dhis.android.core.domain.aggregated.data.internal.AggregatedDataCallBundleKey; import org.hisp.dhis.android.core.period.PeriodType; +import org.hisp.dhis.android.core.resource.internal.ResourceHandler; import org.junit.Before; import java.io.IOException; import java.util.List; -import java.util.concurrent.Callable; + +import io.reactivex.Single; import static org.hisp.dhis.android.core.data.datavalue.DataValueUtils.getDataSets; import static org.hisp.dhis.android.core.data.datavalue.DataValueUtils.getOrgUnitUids; @@ -55,18 +57,15 @@ public class DataValueEndpointCallRealIntegrationShould extends BaseRealIntegrat * metadataSyncCall. It works against the demo server. */ private D2 d2; - private Callable> dataValueCall; @Before @Override public void setUp() throws IOException { super.setUp(); d2 = D2Factory.forNewDatabase(); - dataValueCall = createCall(); } - private Callable> createCall() { - APICallExecutor apiCallExecutor = APICallExecutorImpl.create(d2.databaseAdapter()); + private Single> download() { Handler dataValueHandler = new ObjectWithoutUidHandlerImpl<>( DataValueStore.create(d2.databaseAdapter())); AggregatedDataCallBundleKey key = AggregatedDataCallBundleKey.builder() @@ -81,7 +80,11 @@ private Callable> createCall() { .periodIds(getPeriodIds()) .rootOrganisationUnitUids(getOrgUnitUids()) .build(); - return new DataValueEndpointCallFactory(getGenericCallData(d2), apiCallExecutor, dataValueHandler).create( + + ResourceHandler resourceHandler = getGenericCallData(d2).resourceHandler(); + APIDownloader apiDownloader = new APIDownloaderImpl(resourceHandler); + DataValueService dataValueService = d2.retrofit().create(DataValueService.class); + return new DataValueCall(dataValueService, dataValueHandler, apiDownloader).download( DataValueQuery.create(bundle)); } @@ -97,6 +100,6 @@ public void download_data_values() throws Exception { DbOpenHelper.java replacing 'foreign_keys = ON' with 'foreign_keys = OFF' and uncomment the @Test tag */ - dataValueCall.call(); + download().blockingGet(); } } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/internal/DataValuePostCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/internal/DataValuePostCallRealIntegrationShould.java index 454728d4d4..ed56f105d3 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/internal/DataValuePostCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/datavalue/internal/DataValuePostCallRealIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.datavalue.internal; @@ -61,7 +61,7 @@ public void dataValuesWithToPostState_shouldBeUploaded() throws Exception { d2.userModule().logIn(username, password, url).blockingGet(); d2.metadataModule().blockingDownload(); - d2.aggregatedModule().data().download().subscribe(); + d2.aggregatedModule().data().blockingDownload(); DataValue dataValue = getTestDataValueWith(State.TO_POST, 1); @@ -81,7 +81,7 @@ public void dataValuesWithToPostState_shouldBeUploaded() throws Exception { public void dataValuesWithToUpdateState_shouldBeUploaded() throws Exception { d2.metadataModule().blockingDownload(); - d2.aggregatedModule().data().download().subscribe(); + d2.aggregatedModule().data().blockingDownload(); DataValue dataValue = getTestDataValueWith(State.TO_UPDATE,2); diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/debug/flipper/debug/FlipperManager.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/debug/flipper/debug/FlipperManager.kt new file mode 100644 index 0000000000..296c3c6b69 --- /dev/null +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/debug/flipper/debug/FlipperManager.kt @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2004-2021, 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.debug.flipper.debug + +import android.content.Context +import com.facebook.flipper.android.AndroidFlipperClient +import com.facebook.flipper.android.utils.FlipperUtils +import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin +import com.facebook.flipper.plugins.inspector.DescriptorMapping +import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin +import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor +import com.facebook.flipper.plugins.network.NetworkFlipperPlugin +import com.facebook.soloader.SoLoader +import okhttp3.Interceptor +import org.hisp.dhis.android.BuildConfig + +object FlipperManager { + + /** + * The set up will only apply in debug mode to make sure your data is safe in the production app + * In production, the interceptor will be null + */ + @JvmStatic + fun setUp(context: Context): Interceptor? { + val appContext = context.applicationContext + return if (BuildConfig.DEBUG && FlipperUtils.shouldEnableFlipper(appContext)) { + val networkPlugin = NetworkFlipperPlugin() + SoLoader.init(appContext, false) + val client = AndroidFlipperClient.getInstance(appContext) + client.addPlugin(networkPlugin) + client.addPlugin(DatabasesFlipperPlugin(appContext)) + client.addPlugin(InspectorFlipperPlugin(appContext, DescriptorMapping.withDefaults())) + client.start() + FlipperOkhttpInterceptor(networkPlugin) + } else { + null + } + } +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/domain/aggregated/data/AggregatedDataCallMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/domain/aggregated/data/AggregatedDataCallMockIntegrationShould.java index a8dc72e366..8cc413089f 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/domain/aggregated/data/AggregatedDataCallMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/domain/aggregated/data/AggregatedDataCallMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.domain.aggregated.data; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/domain/aggregated/data/AggregatedDataCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/domain/aggregated/data/AggregatedDataCallRealIntegrationShould.java index e95fbda4c2..4fe1d2f5a2 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/domain/aggregated/data/AggregatedDataCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/domain/aggregated/data/AggregatedDataCallRealIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.domain.aggregated.data; @@ -76,7 +76,7 @@ public void response_successful_on_sync_data_once() throws Exception { d2.userModule().logIn(username, password, url).blockingGet(); d2.metadataModule().blockingDownload(); - d2.aggregatedModule().data().download().subscribe(); + d2.aggregatedModule().data().blockingDownload(); } //@Test @@ -86,12 +86,12 @@ public void response_successful_on_sync_data_value_two_times() throws Exception d2.metadataModule().blockingDownload(); long start = System.currentTimeMillis(); - d2.aggregatedModule().data().download().subscribe(); + d2.aggregatedModule().data().blockingDownload(); long end = System.currentTimeMillis(); Log.e("AGGSYN", "AGGSYN first: " + (end - start)); //d2.metadataModule().blockingDownload(); - d2.aggregatedModule().data().download().subscribe(); + d2.aggregatedModule().data().blockingDownload(); long end2 = System.currentTimeMillis(); Log.e("AGGSYN", "AGGSYN second: " + (end2 - end)); diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/domain/aggregated/data/internal/AggregatedDataSyncStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/domain/aggregated/data/internal/AggregatedDataSyncStoreIntegrationShould.java index 029233900b..e372dbfa68 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/domain/aggregated/data/internal/AggregatedDataSyncStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/domain/aggregated/data/internal/AggregatedDataSyncStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.domain.aggregated.data.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/enrollment/CreateEnrollmentUtils.java b/core/src/androidTest/java/org/hisp/dhis/android/core/enrollment/CreateEnrollmentUtils.java index 7634019be1..b74664a236 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/enrollment/CreateEnrollmentUtils.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/enrollment/CreateEnrollmentUtils.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.enrollment; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentStoreIntegrationShould.java index 2f6a87010b..693e963927 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/enrollment/internal/EnrollmentStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.enrollment.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/event/CreateEventUtils.java b/core/src/androidTest/java/org/hisp/dhis/android/core/event/CreateEventUtils.java index a2b676c368..d64fc9693e 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/event/CreateEventUtils.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/event/CreateEventUtils.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.event; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventAPI29RealShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventAPI29RealShould.java index d7151dfd4e..199f20dc4a 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventAPI29RealShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventAPI29RealShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.event.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventAPI30RealShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventAPI30RealShould.java index 43a35c6b45..eff5afc14e 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventAPI30RealShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventAPI30RealShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.event.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventAPIRealShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventAPIRealShould.java index 44b48d3ae4..49803c030e 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventAPIRealShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventAPIRealShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.event.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventCallFactory.java b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventCallFactory.java deleted file mode 100644 index e035da894c..0000000000 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventCallFactory.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2004-2019, 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.event.internal; - -import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutorImpl; -import org.hisp.dhis.android.core.arch.db.access.DatabaseAdapter; -import org.hisp.dhis.android.core.event.Event; - -import java.util.List; -import java.util.concurrent.Callable; - -import retrofit2.Retrofit; - -public class EventCallFactory { - public static Callable> create(Retrofit retrofit, - DatabaseAdapter databaseAdapter, - String orgUnit, - int pageSize) { - - EventQuery eventQuery = EventQuery.builder() - .orgUnit(orgUnit) - .pageSize(pageSize) - .build(); - - return new EventEndpointCallFactory(retrofit.create(EventService.class), - APICallExecutorImpl.create(databaseAdapter)).getCall(eventQuery); - } -} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventCallFactory.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventCallFactory.kt new file mode 100644 index 0000000000..bd2d32a945 --- /dev/null +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventCallFactory.kt @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2004-2021, 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.event.internal + +import java.util.concurrent.Callable +import org.hisp.dhis.android.core.arch.api.executors.internal.APICallExecutorImpl +import org.hisp.dhis.android.core.arch.db.access.DatabaseAdapter +import org.hisp.dhis.android.core.event.Event +import retrofit2.Retrofit + +object EventCallFactory { + @JvmStatic + fun create( + retrofit: Retrofit, + databaseAdapter: DatabaseAdapter, + orgUnit: String?, + pageSize: Int, + uids: Collection = emptyList() + + ): Callable> { + + val eventQuery = EventQuery.builder() + .orgUnit(orgUnit) + .pageSize(pageSize) + .uids(uids) + .build() + + return EventEndpointCallFactory( + retrofit.create(EventService::class.java), + APICallExecutorImpl.create(databaseAdapter) + ).getCall(eventQuery) + } +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventDataFilterStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventDataFilterStoreIntegrationShould.java new file mode 100644 index 0000000000..6710f5df12 --- /dev/null +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventDataFilterStoreIntegrationShould.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2004-2021, 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.event.internal; + +import org.hisp.dhis.android.core.data.database.ObjectStoreAbstractIntegrationShould; +import org.hisp.dhis.android.core.data.event.EventDataFilterSamples; +import org.hisp.dhis.android.core.event.EventDataFilter; +import org.hisp.dhis.android.core.event.EventDataFilterTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.TestDatabaseAdapterFactory; +import org.hisp.dhis.android.core.utils.runner.D2JunitRunner; +import org.junit.runner.RunWith; + +@RunWith(D2JunitRunner.class) +public class EventDataFilterStoreIntegrationShould extends ObjectStoreAbstractIntegrationShould { + + public EventDataFilterStoreIntegrationShould() { + super(EventDataFilterStore.create(TestDatabaseAdapterFactory.get()), + EventDataFilterTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); + } + + @Override + protected EventDataFilter buildObject() { + return EventDataFilterSamples.get(); + } +} \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventDownloadRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventDownloadRealIntegrationShould.java new file mode 100644 index 0000000000..eb9988f0e3 --- /dev/null +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventDownloadRealIntegrationShould.java @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2004-2021, 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.event.internal; + +import org.hisp.dhis.android.core.BaseRealIntegrationTest; +import org.hisp.dhis.android.core.D2; +import org.hisp.dhis.android.core.D2Factory; +import org.junit.Before; + +import java.io.IOException; + +import static com.google.common.truth.Truth.assertThat; + +public class EventDownloadRealIntegrationShould extends BaseRealIntegrationTest { + + private D2 d2; + + @Before + @Override + public void setUp() throws IOException { + super.setUp(); + + d2 = D2Factory.forNewDatabase(); + } + + //@Test + public void download_events() { + d2.userModule().logIn(username, password, url).blockingGet(); + + d2.metadataModule().blockingDownload(); + + d2.eventModule().eventDownloader().limit(20).blockingDownload(); + + int count = d2.eventModule().events().blockingCount(); + + assertThat(count).isEqualTo(20); + } +} \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventEndpointCallMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventEndpointCallMockIntegrationShould.java deleted file mode 100644 index 17d0f845f6..0000000000 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventEndpointCallMockIntegrationShould.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) 2004-2019, 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.event.internal; - -import org.hisp.dhis.android.core.common.State; -import org.hisp.dhis.android.core.event.Event; -import org.hisp.dhis.android.core.event.EventStatus; -import org.hisp.dhis.android.core.maintenance.D2Error; -import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestMetadataEnqueable; -import org.hisp.dhis.android.core.utils.runner.D2JunitRunner; -import org.junit.After; -import org.junit.Test; -import org.junit.runner.RunWith; - -import java.util.List; -import java.util.concurrent.Callable; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; - -@RunWith(D2JunitRunner.class) -public class EventEndpointCallMockIntegrationShould extends BaseMockIntegrationTestMetadataEnqueable { - - @After - public void tearDown() throws D2Error { - d2.wipeModule().wipeData(); - } - - @Test - public void download_events_according_to_default_query() throws Exception { - Callable> eventEndpointCall = EventCallFactory.create(d2.retrofit(), d2.databaseAdapter(), "DiszpKrYNg8", 0); - - dhis2MockServer.enqueueMockResponse("event/events_1.json"); - - List events = eventEndpointCall.call(); - - ((EventModuleImpl) d2.eventModule()).eventPersistenceCallFactory.persistEvents(events).blockingGet(); - - assertThat(d2.eventModule().events().blockingCount(), is(1)); - } - - @Test - public void download_number_of_events_according_to_page_size() throws Exception { - int pageSize = 1; - - Callable> eventEndpointCall = EventCallFactory.create(d2.retrofit(), d2.databaseAdapter(), "DiszpKrYNg8", pageSize); - - dhis2MockServer.enqueueMockResponse("event/events_1.json"); - - List events = eventEndpointCall.call(); - - ((EventModuleImpl) d2.eventModule()).eventPersistenceCallFactory.persistEvents(events).blockingGet(); - - assertThat(d2.eventModule().events().blockingCount(), is(pageSize)); - } - - @Test - public void rollback_transaction_when_insert_a_event_with_wrong_foreign_key() throws Exception { - Callable> eventEndpointCall = EventCallFactory.create(d2.retrofit(), d2.databaseAdapter(), "DiszpKrYNg8", 0); - - dhis2MockServer.enqueueMockResponse( - "event/two_events_first_good_second_wrong_foreign_key.json"); - - eventEndpointCall.call(); - - assertThat(d2.eventModule().events().blockingCount(), is(0)); - assertThat(d2.trackedEntityModule().trackedEntityDataValues().blockingCount(), is(0)); - } - - @Test - public void not_overwrite_events_marked_as_to_post_to_update_or_error() throws Exception { - int pageSize = 1; - - Callable> eventEndpointCall = EventCallFactory.create(d2.retrofit(), d2.databaseAdapter(), "DiszpKrYNg8", pageSize); - dhis2MockServer.enqueueMockResponse("event/events_1.json"); - - List events = eventEndpointCall.call(); - ((EventModuleImpl) d2.eventModule()).eventPersistenceCallFactory.persistEvents(events).blockingGet(); - - Event event = events.get(0); - assertThat(event.uid(), is("V1CerIi3sdL")); - assertThat(d2.eventModule().events().blockingCount(), is(pageSize)); - - EventStoreImpl.create(d2.databaseAdapter()).update(event.toBuilder() - .state(State.SYNCED).status(EventStatus.SKIPPED).build()); - - ((EventModuleImpl) d2.eventModule()).eventPersistenceCallFactory.persistEvents(events).blockingGet(); - - Event event1 = d2.eventModule().events().one().blockingGet(); - assertThat(event1.uid(), is("V1CerIi3sdL")); - assertThat(event1.status(), is(EventStatus.COMPLETED)); // Because in Synced state should overwrite. - - EventStoreImpl.create(d2.databaseAdapter()).update(event.toBuilder() - .state(State.TO_UPDATE).status(EventStatus.SKIPPED).build()); - - ((EventModuleImpl) d2.eventModule()).eventPersistenceCallFactory.persistEvents(events).blockingGet(); - - Event event2 = d2.eventModule().events().one().blockingGet(); - assertThat(event2.uid(), is("V1CerIi3sdL")); - assertThat(event2.status(), is(EventStatus.SKIPPED)); - - EventStoreImpl.create(d2.databaseAdapter()).update(event.toBuilder() - .state(State.ERROR).status(EventStatus.SKIPPED).build()); - - ((EventModuleImpl) d2.eventModule()).eventPersistenceCallFactory.persistEvents(events).blockingGet(); - - Event event3 = d2.eventModule().events().one().blockingGet(); - assertThat(event3.uid(), is("V1CerIi3sdL")); - assertThat(event3.status(), is(EventStatus.SKIPPED)); - - EventStoreImpl.create(d2.databaseAdapter()).update(event.toBuilder() - .state(State.TO_POST).status(EventStatus.SKIPPED).build()); - - ((EventModuleImpl) d2.eventModule()).eventPersistenceCallFactory.persistEvents(events).blockingGet(); - - Event event4 = d2.eventModule().events().one().blockingGet(); - assertThat(event4.uid(), is("V1CerIi3sdL")); - assertThat(event4.status(), is(EventStatus.SKIPPED)); - } -} \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventEndpointCallMockIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventEndpointCallMockIntegrationShould.kt new file mode 100644 index 0000000000..325e4267cc --- /dev/null +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventEndpointCallMockIntegrationShould.kt @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2004-2021, 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.event.internal + +import com.google.common.truth.Truth.assertThat +import org.hisp.dhis.android.core.common.State +import org.hisp.dhis.android.core.event.EventStatus +import org.hisp.dhis.android.core.maintenance.D2Error +import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestMetadataEnqueable +import org.hisp.dhis.android.core.utils.runner.D2JunitRunner +import org.junit.After +import org.junit.Test +import org.junit.runner.RunWith + +@RunWith(D2JunitRunner::class) +class EventEndpointCallMockIntegrationShould : BaseMockIntegrationTestMetadataEnqueable() { + + @After + @Throws(D2Error::class) + fun tearDown() { + d2.wipeModule().wipeData() + } + + @Test + @Throws(Exception::class) + fun download_number_of_events_according_to_page_default_query() { + enqueue("event/events_1.json") + d2.eventModule().eventDownloader().blockingDownload() + assertThat(d2.eventModule().events().blockingCount()).isEqualTo(1) + } + + @Test + @Throws(Exception::class) + fun rollback_transaction_when_insert_a_event_with_wrong_foreign_key() { + enqueue("event/two_events_first_good_second_wrong_foreign_key.json") + d2.eventModule().eventDownloader().blockingDownload() + assertThat(d2.eventModule().events().blockingCount()).isEqualTo(0) + assertThat(d2.trackedEntityModule().trackedEntityDataValues().blockingCount()) + .isEqualTo(0) + } + + @Test + @Throws(Exception::class) + fun download_events_by_uid() { + enqueue("event/events_with_uids.json") + d2.eventModule().eventDownloader().byUid().`in`("wAiGPfJGMxt", "PpNGhvEYnXe").blockingDownload() + assertThat(d2.eventModule().events().blockingCount()).isEqualTo(2) + } + + @Throws(Exception::class) + private fun checkOverwrite(state: State, finalStatus: EventStatus) { + enqueue("event/events_1.json") + d2.eventModule().eventDownloader().blockingDownload() + + val events = d2.eventModule().events().blockingGet() + val event = events[0] + assertThat(event.uid()).isEqualTo("V1CerIi3sdL") + assertThat(events.size).isEqualTo(1) + EventStoreImpl.create(d2.databaseAdapter()).update( + event.toBuilder() + .state(state).status(EventStatus.SKIPPED).build() + ) + + enqueue("event/events_1.json") + d2.eventModule().eventDownloader().blockingDownload() + + val event1 = d2.eventModule().events().one().blockingGet() + assertThat(event1.uid()).isEqualTo("V1CerIi3sdL") + assertThat(event1.status()).isEqualTo(finalStatus) + } + + @Test + @Throws(Exception::class) + fun overwrite_when_state_sync() { + checkOverwrite(State.SYNCED, EventStatus.COMPLETED) + } + + @Test + @Throws(Exception::class) + fun not_overwrite_when_state_to_post() { + checkOverwrite(State.TO_POST, EventStatus.SKIPPED) + } + + @Test + @Throws(Exception::class) + fun not_overwrite_when_state_error() { + checkOverwrite(State.ERROR, EventStatus.SKIPPED) + } + + @Test + @Throws(Exception::class) + fun not_overwrite_when_state_to_update() { + checkOverwrite(State.TO_UPDATE, EventStatus.SKIPPED) + } + + private fun enqueue(url: String) { + dhis2MockServer.enqueueSystemInfoResponse() + dhis2MockServer.enqueueMockResponse(url) + } +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventEndpointCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventEndpointCallRealIntegrationShould.java index 07c4864fa4..a37697116f 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventEndpointCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventEndpointCallRealIntegrationShould.java @@ -1,35 +1,33 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.event.internal; -import com.google.common.truth.Truth; - import org.hisp.dhis.android.core.BaseRealIntegrationTest; import org.hisp.dhis.android.core.D2; import org.hisp.dhis.android.core.D2Factory; @@ -39,12 +37,11 @@ import org.junit.Before; import java.io.IOException; +import java.util.Collections; import java.util.List; import java.util.concurrent.Callable; -import static junit.framework.Assert.assertTrue; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; public class EventEndpointCallRealIntegrationShould extends BaseRealIntegrationTest { @@ -67,10 +64,10 @@ public void download_number_of_events_according_to_default_limit() throws Except d2.metadataModule().blockingDownload(); - Callable> eventEndpointCall = EventCallFactory.create(d2.retrofit(), d2.databaseAdapter(), "DiszpKrYNg8", 0); + Callable> eventEndpointCall = EventCallFactory.create(d2.retrofit(), d2.databaseAdapter(), "DiszpKrYNg8", 0, Collections.emptyList()); List events = eventEndpointCall.call(); - Truth.assertThat(events.isEmpty()).isFalse(); + assertThat(events.isEmpty()).isFalse(); //TODO: we should create dependant server data verifications in other test suite /* verifyNumberOfDownloadedEvents(49); @@ -84,18 +81,18 @@ public void download_event_with_category_combo_option() throws Exception { d2.metadataModule().blockingDownload(); - Callable> eventEndpointCall = EventCallFactory.create(d2.retrofit(), d2.databaseAdapter(), "DiszpKrYNg8", 0); + Callable> eventEndpointCall = EventCallFactory.create(d2.retrofit(), d2.databaseAdapter(), "DiszpKrYNg8", 0, Collections.emptyList()); eventEndpointCall.call(); - assertTrue(verifyAtLeastOneEventWithOptionCombo()); + assertThat(verifyAtLeastOneEventWithOptionCombo()).isTrue(); } private boolean verifyAtLeastOneEventWithOptionCombo() { EventStore eventStore = EventStoreImpl.create(d2.databaseAdapter()); List downloadedEvents = eventStore.querySingleEvents(); - for(Event event : downloadedEvents){ + for (Event event : downloadedEvents) { if (event.attributeOptionCombo() != null) { return true; } @@ -108,7 +105,7 @@ private void verifyNumberOfDownloadedEvents(int numEvents) { List downloadedEvents = eventStore.querySingleEvents(); - assertThat(downloadedEvents.size(), is(numEvents)); + assertThat(downloadedEvents.size()).isEqualTo(numEvents); } private void verifyNumberOfDownloadedTrackedEntityDataValue(int num) { @@ -116,6 +113,6 @@ private void verifyNumberOfDownloadedTrackedEntityDataValue(int num) { int numPersisted = trackedEntityDataValueStore.selectAll().size(); - assertThat(numPersisted, is(num)); + assertThat(numPersisted).isEqualTo(num); } } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventFilterStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventFilterStoreIntegrationShould.java new file mode 100644 index 0000000000..a3c4ac7c28 --- /dev/null +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventFilterStoreIntegrationShould.java @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2004-2021, 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.event.internal; + +import org.hisp.dhis.android.core.data.database.IdentifiableObjectStoreAbstractIntegrationShould; +import org.hisp.dhis.android.core.data.event.EventFilterSamples; +import org.hisp.dhis.android.core.event.EventFilter; +import org.hisp.dhis.android.core.event.EventFilterTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.TestDatabaseAdapterFactory; +import org.hisp.dhis.android.core.utils.runner.D2JunitRunner; +import org.junit.runner.RunWith; + +@RunWith(D2JunitRunner.class) +public class EventFilterStoreIntegrationShould + extends IdentifiableObjectStoreAbstractIntegrationShould { + + public EventFilterStoreIntegrationShould() { + super(EventFilterStore.create(TestDatabaseAdapterFactory.get()), + EventFilterTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); + } + + @Override + protected EventFilter buildObject() { + return EventFilterSamples.get(); + } + + @Override + protected EventFilter buildObjectToUpdate() { + return EventFilterSamples.get().toBuilder() + .description("new_description") + .build(); + } +} \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventPostCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventPostCallRealIntegrationShould.java index c0be74365e..23e810c7bc 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventPostCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventPostCallRealIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.event.internal; @@ -33,30 +33,28 @@ import org.hisp.dhis.android.core.D2Factory; import org.hisp.dhis.android.core.arch.helpers.UidGenerator; import org.hisp.dhis.android.core.arch.helpers.UidGeneratorImpl; -import org.hisp.dhis.android.core.common.FeatureType; -import org.hisp.dhis.android.core.common.Geometry; import org.hisp.dhis.android.core.common.State; import org.hisp.dhis.android.core.event.Event; +import org.hisp.dhis.android.core.event.EventCreateProjection; +import org.hisp.dhis.android.core.event.EventObjectRepository; import org.hisp.dhis.android.core.event.EventStatus; -import org.hisp.dhis.android.core.program.ProgramStage; +import org.hisp.dhis.android.core.program.ProgramType; import org.hisp.dhis.android.core.trackedentity.TrackedEntityDataValue; import org.hisp.dhis.android.core.trackedentity.internal.TrackedEntityDataValueStore; import org.hisp.dhis.android.core.trackedentity.internal.TrackedEntityDataValueStoreImpl; import org.junit.Before; import java.io.IOException; +import java.util.Collections; import java.util.Date; import java.util.List; import java.util.concurrent.Callable; import static com.google.common.truth.Truth.assertThat; -import static junit.framework.Assert.assertTrue; public class EventPostCallRealIntegrationShould extends BaseRealIntegrationTest { private D2 d2; - private UidGenerator uidGenerator; - private EventStore eventStore; private TrackedEntityDataValueStore trackedEntityDataValueStore; @@ -78,7 +76,7 @@ public void setUp() throws IOException { eventStore = EventStoreImpl.create(d2.databaseAdapter()); trackedEntityDataValueStore = TrackedEntityDataValueStoreImpl.create(d2.databaseAdapter()); - uidGenerator = new UidGeneratorImpl(); + UidGenerator uidGenerator = new UidGeneratorImpl(); eventUid1 = uidGenerator.generate(); eventUid2 = uidGenerator.generate(); @@ -94,6 +92,28 @@ public void successful_response_after_sync_events() throws Exception { d2.eventModule().events().blockingUpload(); } + //@Test + public void create_event_with_repository() throws Exception { + downloadMetadata(); + + String eventUid = d2.eventModule().events().blockingAdd( + EventCreateProjection.builder() + .organisationUnit(orgUnitUid) + .program(programUid) + .programStage(programStageUid) + .attributeOptionCombo(attributeOptionCombo) + .build() + ); + + EventObjectRepository repo = d2.eventModule().events().uid(eventUid); + + repo.setEventDate(new Date()); + + d2.eventModule().events().blockingUpload(); + } + + + // commented out since it is a flaky test that works against a real server. //@Test public void pull_event_with_correct_category_combo_after_be_pushed() throws Exception { @@ -138,7 +158,6 @@ public void pull_two_events_with_correct_category_combo_after_be_pushed() throws private void createDummyDataToPost(String eventUid) { eventStore.insert(Event.builder().uid(eventUid).created(new Date()).lastUpdated(new Date()) - .geometry(Geometry.builder().type(FeatureType.POINT).coordinates("[12.21, 13.21]").build()) .status(EventStatus.ACTIVE).program(programUid) .programStage(programStageUid).organisationUnit(orgUnitUid).eventDate(new Date()) .completedDate(new Date()).dueDate(new Date()).state(State.TO_POST) @@ -160,12 +179,12 @@ private void createDummyDataToPost(String eventUid) { private void assertThatEventPushedIsDownloaded(Event pushedEvent) { List downloadedEvents = eventStore.querySingleEvents(); - assertTrue(verifyPushedEventIsInPullList(pushedEvent, downloadedEvents)); + assertThat(verifyPushedEventIsInPullList(pushedEvent, downloadedEvents)).isTrue(); } private void downloadEvents() throws Exception { Callable> eventEndpointCall = EventCallFactory.create( - d2.retrofit(), d2.databaseAdapter(), orgUnitUid, 50); + d2.retrofit(), d2.databaseAdapter(), orgUnitUid, 50, Collections.emptyList()); List events = eventEndpointCall.call(); @@ -179,8 +198,8 @@ private void downloadEvents() throws Exception { private Event getEventFromDB() { Event event = null; List storedEvents = eventStore.selectAll(); - for(Event storedEvent : storedEvents) { - if(storedEvent.uid().equals(eventUid1)) { + for (Event storedEvent : storedEvents) { + if (storedEvent.uid().equals(eventUid1)) { event = storedEvent; } } @@ -195,18 +214,32 @@ private void downloadMetadata() { d2.userModule().logIn(username, password, url).blockingGet(); d2.metadataModule().blockingDownload(); - orgUnitUid = d2.organisationUnitModule().organisationUnits().one().blockingGet().uid(); - ProgramStage programStage = d2.programModule().programStages().one().blockingGet(); - programStageUid = programStage.uid(); - programUid = programStage.program().uid(); - dataElementUid = d2.dataElementModule().dataElements().one().blockingGet().uid(); - attributeOptionCombo = d2.categoryModule().categoryOptionCombos().one().blockingGet().uid(); + orgUnitUid = d2.organisationUnitModule().organisationUnits() + .one().blockingGet() + .uid(); + programUid = d2.programModule().programs() + .byOrganisationUnitUid(orgUnitUid) + .byProgramType().eq(ProgramType.WITHOUT_REGISTRATION) + .one().blockingGet() + .uid(); + // Before running, make sure no data elements are compulsory + programStageUid = d2.programModule().programStages() + .byProgramUid().eq(programUid) + .one().blockingGet() + .uid(); + dataElementUid = d2.programModule().programStageDataElements() + .byProgramStage().eq(programStageUid) + .one().blockingGet().dataElement() + .uid(); + attributeOptionCombo = d2.categoryModule().categoryOptionCombos() + .one().blockingGet() + .uid(); } private boolean verifyPushedEventIsInPullList(Event event, List eventList) { - for(Event pullEvent : eventList){ + for (Event pullEvent : eventList) { if (event.uid().equals(pullEvent.uid()) && - event.attributeOptionCombo().equals(pullEvent.attributeOptionCombo())){ + event.attributeOptionCombo().equals(pullEvent.attributeOptionCombo())) { return true; } } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventPostCallMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventPostPayloadGeneratorMockIntegrationShould.java similarity index 76% rename from core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventPostCallMockIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventPostPayloadGeneratorMockIntegrationShould.java index 5e9f16bfef..82c702d52f 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventPostCallMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventPostPayloadGeneratorMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.event.internal; @@ -56,9 +56,9 @@ import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) -public class EventPostCallMockIntegrationShould extends BaseMockIntegrationTestMetadataEnqueable { +public class EventPostPayloadGeneratorMockIntegrationShould extends BaseMockIntegrationTestMetadataEnqueable { - private static EventPostCall eventPostCall; + private static EventPostPayloadGenerator payloadGenerator; private static EventStore eventStore; private final String event1Id = "event1Id"; @@ -70,7 +70,7 @@ public class EventPostCallMockIntegrationShould extends BaseMockIntegrationTestM public static void setUpClass() throws Exception { BaseMockIntegrationTestMetadataEnqueable.setUpClass(); eventStore = EventStoreImpl.create(objects.databaseAdapter); - eventPostCall = objects.d2DIComponent.eventPostCall(); + payloadGenerator = objects.d2DIComponent.eventPostPayloadGenerator(); } @After @@ -82,7 +82,7 @@ public void tearDown() throws D2Error { public void build_payload_with_different_enrollments() { storeEvents(); - List events = eventPostCall.queryDataToSync(null); + List events = payloadGenerator.getEvents(eventStore.querySingleEventsToPost()); assertThat(events.size()).isEqualTo(3); @@ -147,31 +147,13 @@ public void recreate_events_with_filters() { storeSingleEvent(event3, program, State.TO_UPDATE, true); storeSingleEvent(event4, program, State.SYNCED, false); - List events = eventPostCall.queryDataToSync( + List events = payloadGenerator.getEvents( d2.eventModule().events().byProgramUid().eq(program.uid()) .byState().in(State.uploadableStates()).blockingGet()); assertThat(events.size()).isEqualTo(3); assertThat(UidsHelper.getUidsList(events).containsAll(Lists.newArrayList(event1, event2, event3))) - .isEqualTo(true); - } - - @Test - public void mark_payload_as_uploading() { - storeEvents(); - - // Ignore result. Just interested in check that target events are marked as UPLOADING - List events = eventPostCall.queryDataToSync(null); - - List dbEvents = d2.eventModule().events().blockingGet(); - - for (Event event : dbEvents) { - if (event1Id.equals(event.uid()) || event2Id.equals(event.uid()) || event3Id.equals(event.uid())) { - assertThat(event.state()).isEqualTo(State.UPLOADING); - } else { - assertThat(event.state()).isNotEqualTo(State.UPLOADING); - } - } + .isTrue(); } @Test @@ -184,7 +166,7 @@ public void build_payload_with_event_notes() throws D2Error { .value("This is an event note") .build()); - List events = eventPostCall.queryDataToSync(null); + List events = payloadGenerator.getEvents(eventStore.querySingleEventsToPost()); for (Event event : events) { if (event1Id.equals(event.uid())) { diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventStoreIntegrationShould.java index 345e3f9a48..b834ca1a4c 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.event.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventSyncStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventSyncStoreIntegrationShould.java index 4d3251d1c0..c919c05aa3 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventSyncStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventSyncStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.event.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventUtils.java b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventUtils.java index 4bbc264079..669022a081 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventUtils.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventUtils.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.event.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventWithLimitCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventWithLimitCallRealIntegrationShould.java deleted file mode 100644 index f49020a00d..0000000000 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/event/internal/EventWithLimitCallRealIntegrationShould.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2004-2019, 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.event.internal; - -import org.hisp.dhis.android.core.BaseRealIntegrationTest; -import org.hisp.dhis.android.core.D2; -import org.hisp.dhis.android.core.D2Factory; -import org.junit.Before; - -import java.io.IOException; - -import static com.google.common.truth.Truth.assertThat; - -public class EventWithLimitCallRealIntegrationShould extends BaseRealIntegrationTest { - - private D2 d2; - - @Before - @Override - public void setUp() throws IOException { - super.setUp(); - - d2 = D2Factory.forNewDatabase(); - } - - //@Test - public void download_tracked_entity_instances() { - d2.userModule().logIn(username, password, url).blockingGet(); - - d2.metadataModule().blockingDownload(); - - d2.eventModule().eventDownloader().limit(20).blockingDownload(); - - int count = d2.eventModule().events().blockingCount(); - - assertThat(count).isEqualTo(20); - } -} \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/fileresource/internal/FileResourceCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/fileresource/internal/FileResourceCallRealIntegrationShould.java index 41ae47c8c6..d45c8ff02c 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/fileresource/internal/FileResourceCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/fileresource/internal/FileResourceCallRealIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.fileresource.internal; @@ -45,8 +45,7 @@ import java.io.IOException; import java.util.List; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; public class FileResourceCallRealIntegrationShould extends BaseRealIntegrationTest { @@ -68,11 +67,11 @@ public void download_and_write_files_successfully() throws Exception { List fileResources = d2.fileResourceModule().fileResources().blockingGet(); - assertThat(fileResources.size(), is(2)); + assertThat(fileResources.size()).isEqualTo(2); File file = new File(fileResources.get(0).path()); - assertThat(file.exists(), is(true)); + assertThat(file.exists()).isTrue(); } //@Test @@ -85,7 +84,7 @@ public void write_tracked_entity_attribute_related_files_and_upload() throws Exc File file = new File(fileResources.get(0).path()); - assertThat(file.exists(), is(true)); + assertThat(file.exists()).isTrue(); String valueUid = d2.fileResourceModule().fileResources().blockingAdd(file); @@ -104,14 +103,14 @@ public void write_tracked_entity_attribute_related_files_and_upload() throws Exc File file2 = new File(fileResources2.get(1).path()); - assertThat(file2.exists(), is(true)); + assertThat(file2.exists()).isTrue(); d2.trackedEntityModule().trackedEntityInstances().blockingUpload(); TrackedEntityInstance trackedEntityInstance2 = d2.trackedEntityModule().trackedEntityInstances().blockingGet().get(0); - assertThat(trackedEntityInstance2.state(), is(State.SYNCED)); + assertThat(trackedEntityInstance2.state()).isEqualTo(State.SYNCED); } //@Test @@ -124,7 +123,7 @@ public void write_data_element_related_files_and_upload() throws Exception { File file = new File(fileResources.get(0).path()); - assertThat(file.exists(), is(true)); + assertThat(file.exists()).isTrue(); String valueUid = d2.fileResourceModule().fileResources().blockingAdd(file); @@ -141,7 +140,7 @@ public void write_data_element_related_files_and_upload() throws Exception { File file2 = new File(fileResources2.get(1).path()); - assertThat(file2.exists(), is(true)); + assertThat(file2.exists()).isTrue(); } //@Test @@ -156,7 +155,7 @@ public void not_download_existing_resources() throws Exception { List fileResources2 = d2.fileResourceModule().fileResources().blockingGet(); - assertThat(fileResources.size(), is(fileResources2.size())); + assertThat(fileResources.size()).isEqualTo(fileResources2.size()); } private void syncDataAndMetadata() throws Exception { diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/fileresource/internal/FileResourceStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/fileresource/internal/FileResourceStoreIntegrationShould.java index 1b114896b2..6008930a5a 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/fileresource/internal/FileResourceStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/fileresource/internal/FileResourceStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.fileresource.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/imports/internal/TrackerImportConflictStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/imports/internal/TrackerImportConflictStoreIntegrationShould.java index e4ead93f47..c5ac7e419d 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/imports/internal/TrackerImportConflictStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/imports/internal/TrackerImportConflictStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.imports.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/internal/DataSetIndicatorLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/internal/DataSetIndicatorLinkStoreIntegrationShould.java index dca8b5c3a4..44794ce7ef 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/internal/DataSetIndicatorLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/internal/DataSetIndicatorLinkStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.indicator.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/internal/IndicatorStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/internal/IndicatorStoreIntegrationShould.java index f3d766ac7b..1846b8c276 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/internal/IndicatorStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/indicator/internal/IndicatorStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.indicator.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/DataElementLegendSetLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/DataElementLegendSetLinkStoreIntegrationShould.java new file mode 100644 index 0000000000..5cee682254 --- /dev/null +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/DataElementLegendSetLinkStoreIntegrationShould.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2004-2021, 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.legendset; + +import org.hisp.dhis.android.core.data.database.LinkStoreAbstractIntegrationShould; +import org.hisp.dhis.android.core.data.legendset.DataElementLegendSetLinkSamples; +import org.hisp.dhis.android.core.data.legendset.ProgramIndicatorLegendSetLinkSamples; +import org.hisp.dhis.android.core.legendset.internal.DataElementLegendSetLinkStore; +import org.hisp.dhis.android.core.legendset.internal.ProgramIndicatorLegendSetLinkStore; +import org.hisp.dhis.android.core.utils.integration.mock.TestDatabaseAdapterFactory; +import org.hisp.dhis.android.core.utils.runner.D2JunitRunner; +import org.junit.runner.RunWith; + +@RunWith(D2JunitRunner.class) +public class DataElementLegendSetLinkStoreIntegrationShould + extends LinkStoreAbstractIntegrationShould { + + public DataElementLegendSetLinkStoreIntegrationShould() { + super(DataElementLegendSetLinkStore.create(TestDatabaseAdapterFactory.get()), + DataElementLegendSetLinkTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); + } + + @Override + protected String addMasterUid() { + return DataElementLegendSetLinkSamples.getDataElementLegendSetLink().dataElement(); + } + + @Override + protected DataElementLegendSetLink buildObject() { + return DataElementLegendSetLinkSamples.getDataElementLegendSetLink(); + } + + @Override + protected DataElementLegendSetLink buildObjectWithOtherMasterUid() { + return buildObject().toBuilder() + .dataElement("new_data_element") + .build(); + } +} \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/ProgramIndicatorLegendSetLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/ProgramIndicatorLegendSetLinkStoreIntegrationShould.java index b59103adeb..c291fb84f2 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/ProgramIndicatorLegendSetLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/ProgramIndicatorLegendSetLinkStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.legendset; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/internal/LegendSetStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/internal/LegendSetStoreIntegrationShould.java index 7108821913..28c354e182 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/internal/LegendSetStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/internal/LegendSetStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.legendset.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/internal/LegendStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/internal/LegendStoreIntegrationShould.java index df947cc636..c9cdbbaa5c 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/internal/LegendStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/legendset/internal/LegendStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.legendset.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/maintenance/internal/D2ErrorStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/maintenance/internal/D2ErrorStoreIntegrationShould.java index f0c5f85630..50bd527bf4 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/maintenance/internal/D2ErrorStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/maintenance/internal/D2ErrorStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.maintenance.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/maintenance/internal/ForeignKeyCleanerShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/maintenance/internal/ForeignKeyCleanerShould.java index bd79b74ef9..bb5c88cee7 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/maintenance/internal/ForeignKeyCleanerShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/maintenance/internal/ForeignKeyCleanerShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.maintenance.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/maintenance/internal/ForeignKeyViolationStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/maintenance/internal/ForeignKeyViolationStoreIntegrationShould.java index 74619cb2ea..2d7fe653aa 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/maintenance/internal/ForeignKeyViolationStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/maintenance/internal/ForeignKeyViolationStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.maintenance.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/note/NotePostCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/note/NotePostCallRealIntegrationShould.java index d72976d126..f1df9e3785 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/note/NotePostCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/note/NotePostCallRealIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.note; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/note/internal/NoteStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/note/internal/NoteStoreIntegrationShould.java index 3d3888047f..054a300d7f 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/note/internal/NoteStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/note/internal/NoteStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.note.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/option/OptionCallShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/option/OptionCallShould.java index d344995dcd..d9810994f1 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/option/OptionCallShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/option/OptionCallShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.option; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/option/OptionSetCallShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/option/OptionSetCallShould.java index 0794a7a505..4683e0181e 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/option/OptionSetCallShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/option/OptionSetCallShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.option; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/option/internal/OptionGroupOptionLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/option/internal/OptionGroupOptionLinkStoreIntegrationShould.java index ab0c07a46b..0ab8b4c7cd 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/option/internal/OptionGroupOptionLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/option/internal/OptionGroupOptionLinkStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.option.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/option/internal/OptionGroupStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/option/internal/OptionGroupStoreIntegrationShould.java index 2f04d32f7e..98df91861e 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/option/internal/OptionGroupStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/option/internal/OptionGroupStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.option.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitCallMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitCallMockIntegrationShould.java index 24cc4d16b4..b0b539cb06 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitCallMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitCallMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.organisationunit.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitGroupStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitGroupStoreIntegrationShould.java index ed25e019d7..3f9a2d0e2c 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitGroupStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitGroupStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.organisationunit.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitLevelStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitLevelStoreIntegrationShould.java index 13c5ea8328..9721d7f17c 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitLevelStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitLevelStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2017, University of Oslo + * Copyright (c) 2004-2021, University of Oslo + * All rights reserved. * - * 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. + * 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. + * 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. + * 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.organisationunit.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitOrganisationUnitGroupLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitOrganisationUnitGroupLinkStoreIntegrationShould.java index 95e423e18e..f2016c1b49 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitOrganisationUnitGroupLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitOrganisationUnitGroupLinkStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.organisationunit.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitProgramLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitProgramLinkStoreIntegrationShould.java index 20d5763c96..a81f51d56c 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitProgramLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitProgramLinkStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.organisationunit.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitStoreIntegrationShould.java index 4e8c5ca8e1..df57dc1915 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/organisationunit/internal/OrganisationUnitStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.organisationunit.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/period/PeriodMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/period/PeriodMockIntegrationShould.java index ae570c2b25..4fb899bd7a 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/period/PeriodMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/period/PeriodMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.period; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/period/PeriodParserMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/period/PeriodParserMockIntegrationShould.java index 1c5a1721c9..3c7f9f3c85 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/period/PeriodParserMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/period/PeriodParserMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.period; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/period/internal/PeriodStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/period/internal/PeriodStoreIntegrationShould.java index b3c277ed50..45431c7051 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/period/internal/PeriodStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/period/internal/PeriodStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.period.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/CreateProgramStageUtils.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/CreateProgramStageUtils.java index 0d72c0e065..fe5c1a2ab5 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/CreateProgramStageUtils.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/CreateProgramStageUtils.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.program; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramIndicatorEngineIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramIndicatorEngineIntegrationShould.java deleted file mode 100644 index 5d1f13affa..0000000000 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/ProgramIndicatorEngineIntegrationShould.java +++ /dev/null @@ -1,391 +0,0 @@ -/* - * Copyright (c) 2004-2019, 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.program; - -import android.content.ContentValues; - -import androidx.test.runner.AndroidJUnit4; - -import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; -import org.hisp.dhis.android.core.category.CategoryCombo; -import org.hisp.dhis.android.core.category.CategoryComboTableInfo; -import org.hisp.dhis.android.core.category.internal.CreateCategoryComboUtils; -import org.hisp.dhis.android.core.common.Access; -import org.hisp.dhis.android.core.common.AggregationType; -import org.hisp.dhis.android.core.common.DataAccess; -import org.hisp.dhis.android.core.common.FormType; -import org.hisp.dhis.android.core.common.ObjectWithUid; -import org.hisp.dhis.android.core.common.ValueType; -import org.hisp.dhis.android.core.dataelement.DataElement; -import org.hisp.dhis.android.core.dataelement.internal.DataElementStore; -import org.hisp.dhis.android.core.enrollment.Enrollment; -import org.hisp.dhis.android.core.enrollment.internal.EnrollmentStoreImpl; -import org.hisp.dhis.android.core.event.Event; -import org.hisp.dhis.android.core.event.internal.EventStoreImpl; -import org.hisp.dhis.android.core.maintenance.D2Error; -import org.hisp.dhis.android.core.organisationunit.OrganisationUnit; -import org.hisp.dhis.android.core.organisationunit.internal.OrganisationUnitStore; -import org.hisp.dhis.android.core.program.internal.ProgramIndicatorStore; -import org.hisp.dhis.android.core.program.internal.ProgramStageStore; -import org.hisp.dhis.android.core.program.internal.ProgramStore; -import org.hisp.dhis.android.core.program.programindicatorengine.ProgramIndicatorEngine; -import org.hisp.dhis.android.core.trackedentity.TrackedEntityAttribute; -import org.hisp.dhis.android.core.trackedentity.TrackedEntityAttributeValue; -import org.hisp.dhis.android.core.trackedentity.TrackedEntityDataValue; -import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstance; -import org.hisp.dhis.android.core.trackedentity.TrackedEntityType; -import org.hisp.dhis.android.core.trackedentity.internal.TrackedEntityAttributeStore; -import org.hisp.dhis.android.core.trackedentity.internal.TrackedEntityAttributeValueStoreImpl; -import org.hisp.dhis.android.core.trackedentity.internal.TrackedEntityDataValueStoreImpl; -import org.hisp.dhis.android.core.trackedentity.internal.TrackedEntityInstanceStore; -import org.hisp.dhis.android.core.trackedentity.internal.TrackedEntityInstanceStoreImpl; -import org.hisp.dhis.android.core.trackedentity.internal.TrackedEntityTypeStore; -import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestEmptyDispatcher; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; - -import static com.google.common.truth.Truth.assertThat; - -@RunWith(AndroidJUnit4.class) -public class ProgramIndicatorEngineIntegrationShould extends BaseMockIntegrationTestEmptyDispatcher { - - private static String teiUid = "H87GEVeG3JH"; - private static String enrollmentUid = "la16vwCoFM8"; - private static String event1 = "gphKB0UjOrX"; - private static String event2 = "EAZOUgr2Ksv"; - private static String event3 = "BVL4LcEEDdU"; - - private static String dataElement1 = "ddaBs9lgZyP"; - private static String dataElement2 = "Kb9hZ428FyH"; - private static String attribute1 = "Kmtdopp5GC1"; - private static String programIndicatorUid = "rg3JkCv0skl"; - - // Auxiliary variables - private static String orgunitUid = "orgunit_uid"; - private static String teiTypeUid = "tei_type_uid"; - private static String programUid = "program_uid"; - private static String programStage1 = "iM4svLr2hlO"; - private static String programStage2 = "RXFTSe1oefv"; - - private static ProgramIndicatorEngine programIndicatorEngine; - - @Before - public void setUp() throws Exception { - BaseMockIntegrationTestEmptyDispatcher.setUpClass(); - - programIndicatorEngine = d2.programModule().programIndicatorEngine(); - - OrganisationUnit orgunit = OrganisationUnit.builder().uid(orgunitUid).build(); - OrganisationUnitStore.create(databaseAdapter).insert(orgunit); - - TrackedEntityType trackedEntityType = TrackedEntityType.builder().uid(teiTypeUid).build(); - TrackedEntityTypeStore.create(databaseAdapter).insert(trackedEntityType); - - TrackedEntityInstanceStore teiStore = TrackedEntityInstanceStoreImpl.create(databaseAdapter); - TrackedEntityInstance trackedEntityInstance = TrackedEntityInstance.builder() - .uid(teiUid) - .created(new Date()) - .lastUpdated(new Date()) - .organisationUnit(orgunitUid) - .trackedEntityType(teiTypeUid) - .build(); - - teiStore.insert(trackedEntityInstance); - - ContentValues categoryCombo = CreateCategoryComboUtils.create(1L, CategoryCombo.DEFAULT_UID); - databaseAdapter.insert(CategoryComboTableInfo.TABLE_INFO.name(), null, categoryCombo); - - Access access = Access.create(true, null, DataAccess.create(true, true)); - Program program = Program.builder().uid(programUid) - .access(access) - .trackedEntityType(TrackedEntityType.builder().uid(teiTypeUid).build()) - .build(); - ProgramStore.create(databaseAdapter).insert(program); - - ProgramStage stage1 = ProgramStage.builder().uid(programStage1).program(ObjectWithUid.create(programUid)) - .formType(FormType.CUSTOM).build(); - ProgramStage stage2 = ProgramStage.builder().uid(programStage2).program(ObjectWithUid.create(programUid)) - .formType(FormType.CUSTOM).build(); - - IdentifiableObjectStore programStageStore = ProgramStageStore.create(databaseAdapter); - programStageStore.insert(stage1); - programStageStore.insert(stage2); - - DataElement de1 = DataElement.builder().uid(dataElement1).valueType(ValueType.NUMBER).build(); - DataElement de2 = DataElement.builder().uid(dataElement2).valueType(ValueType.NUMBER).build(); - IdentifiableObjectStore dataElementStore = DataElementStore.create(databaseAdapter); - dataElementStore.insert(de1); - dataElementStore.insert(de2); - - TrackedEntityAttribute tea = TrackedEntityAttribute.builder().uid(attribute1).build(); - TrackedEntityAttributeStore.create(databaseAdapter).insert(tea); - } - - @After - public void tearDown() throws D2Error { - d2.wipeModule().wipeEverything(); - } - - @Test - public void evaluate_single_dataelement() { - createEnrollment(null,null); - createEvent(event1, programStage1, new Date()); - insertTrackedEntityDataValue(event1, dataElement1, "4"); - - setProgramIndicatorExpressionAsAverage(de(programStage1,dataElement1)); - - String result = programIndicatorEngine.getProgramIndicatorValue(enrollmentUid, event1, programIndicatorUid); - - assertThat(result).isEqualTo("4"); - } - - @Test - public void evaluate_single_text_dataelement() { - createEnrollment(null,null); - createEvent(event1, programStage1, new Date()); - insertTrackedEntityDataValue(event1, dataElement1, "text data-value"); - - setProgramIndicatorExpressionAsAverage(de(programStage1,dataElement1)); - - String result = programIndicatorEngine.getProgramIndicatorValue(enrollmentUid, event1, programIndicatorUid); - - assertThat(result).isEqualTo("text data-value"); - } - - @Test - public void evaluate_addition_two_dataelement() { - createEnrollment(null, null); - createEvent(event1, programStage1, null); - insertTrackedEntityDataValue(event1, dataElement1, "5"); - insertTrackedEntityDataValue(event1, dataElement2, "3"); - - setProgramIndicatorExpressionAsAverage(de(programStage1,dataElement1) + " * " + de(programStage1,dataElement2)); - - String result = programIndicatorEngine.getProgramIndicatorValue(enrollmentUid, event1, programIndicatorUid); - - assertThat(result).isEqualTo("15"); - } - - @Test - public void evaluate_division_two_dataelement() { - createEnrollment(null, null); - createEvent(event1, programStage1, null); - insertTrackedEntityDataValue(event1, dataElement1, "3"); - insertTrackedEntityDataValue(event1, dataElement2, "5"); - - setProgramIndicatorExpressionAsAverage(de(programStage1,dataElement1) + " / " + de(programStage1,dataElement2)); - - String result = programIndicatorEngine.getProgramIndicatorValue(enrollmentUid, event1, programIndicatorUid); - - assertThat(result).isEqualTo("0.6"); - } - - @Test - public void evaluate_last_value_indicators_different_dates() { - createEnrollment(null, null); - createEvent(event1, programStage1, twoDaysBefore(), today()); - createEvent(event2, programStage1, today(), today()); - createEvent(event3, programStage1, twoDaysBefore(), today()); - insertTrackedEntityDataValue(event1, dataElement1, "1"); - insertTrackedEntityDataValue(event2, dataElement1, "2"); // Expected as last value - insertTrackedEntityDataValue(event3, dataElement1, "3"); - - setProgramIndicatorExpressionAsLast(de(programStage1,dataElement1)); - - String result = programIndicatorEngine.getProgramIndicatorValue(enrollmentUid, null, programIndicatorUid); - - assertThat(result).isEqualTo("2"); - } - - @Test - public void evaluate_last_value_indicators_same_date() { - createEnrollment(null, null); - Date eventDate = twoDaysBefore(); - createEvent(event1, programStage1, eventDate, twoDaysBefore()); - createEvent(event2, programStage1, eventDate, today()); - createEvent(event3, programStage1, eventDate, twoDaysBefore()); - insertTrackedEntityDataValue(event1, dataElement1, "1"); - insertTrackedEntityDataValue(event2, dataElement1, "2"); // Expected as last value - insertTrackedEntityDataValue(event3, dataElement1, "3"); - - setProgramIndicatorExpressionAsLast(de(programStage1,dataElement1)); - - String result = programIndicatorEngine.getProgramIndicatorValue(enrollmentUid, null, programIndicatorUid); - - assertThat(result).isEqualTo("2"); - } - - @Test - public void evaluate_operation_several_stages() { - createEnrollment(null, null); - createEvent(event1, programStage1, null); - createEvent(event2, programStage2, null); - - insertTrackedEntityDataValue(event1, dataElement1, "5"); - insertTrackedEntityDataValue(event2, dataElement2, "1.5"); - insertTrackedEntityAttributeValue(attribute1, "2"); - - setProgramIndicatorExpressionAsAverage("(" + de(programStage1,dataElement1) + " + " + de(programStage2,dataElement2) + - ") / " + att(attribute1)); - - String resultWithoutEvent = programIndicatorEngine.getProgramIndicatorValue(enrollmentUid, null, - programIndicatorUid); - String resultWithEvent = programIndicatorEngine.getProgramIndicatorValue(enrollmentUid, event1, - programIndicatorUid); - - assertThat(resultWithoutEvent).isEqualTo("3.25"); - assertThat(resultWithEvent).isEqualTo("3.25"); - } - - @Test - public void evaluate_event_count_variable() { - createEnrollment(null, null); - createEvent(event1, programStage1, null); - createEvent(event2, programStage2, null); - createDeletedEvent(event3, programStage2); - - setProgramIndicatorExpressionAsAverage(var("event_count")); - - String result = programIndicatorEngine.getProgramIndicatorValue(enrollmentUid, null, - programIndicatorUid); - - assertThat(result).isEqualTo("2"); - } - - @Test - public void evaluate_expression_with_d2_functions() { - createEnrollment(null, null); - createEvent(event1, programStage1, null); - insertTrackedEntityDataValue(event1, dataElement1, "4.8"); - insertTrackedEntityDataValue(event1, dataElement2, "3"); - - setProgramIndicatorExpressionAsAverage("d2:round(" + de(programStage1,dataElement1) + ") * " + - de(programStage1, dataElement2)); - - String result = programIndicatorEngine.getProgramIndicatorValue(enrollmentUid, event1, programIndicatorUid); - - assertThat(result).isEqualTo("15"); - } - - @Test - public void evaluate_d2_functions_with_dates() throws ParseException { - Date enrollmentDate = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS").parse("2018-05-05T00:00:00.000"); - Date incidentDate = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS").parse("2018-05-21T00:00:00.000"); - - createEnrollment(enrollmentDate, incidentDate); - - setProgramIndicatorExpressionAsAverage("d2:daysBetween(V{enrollment_date}, V{incident_date})"); - - String result = programIndicatorEngine.getProgramIndicatorValue(enrollmentUid, null, programIndicatorUid); - - assertThat(result).isEqualTo("16"); - } - - private void createEnrollment(Date enrollmentDate, Date incidentDate) { - Enrollment enrollment = Enrollment.builder().uid(enrollmentUid).organisationUnit(orgunitUid).program(programUid) - .enrollmentDate(enrollmentDate).incidentDate(incidentDate).trackedEntityInstance(teiUid).build(); - EnrollmentStoreImpl.create(databaseAdapter).insert(enrollment); - } - - private void createEvent(String eventUid, String programStageUid, Date eventDate, Date lastUpdated) { - Event event = Event.builder().uid(eventUid).enrollment(enrollmentUid).lastUpdated(lastUpdated) - .program(programUid).programStage(programStageUid).organisationUnit(orgunitUid) - .eventDate(eventDate).deleted(false).build(); - - EventStoreImpl.create(databaseAdapter).insert(event); - } - - private void createEvent(String eventUid, String programStageUid, Date eventDate) { - createEvent(eventUid, programStageUid, eventDate, null); - } - - private void createDeletedEvent(String eventUid, String programStageUid) { - Event event = Event.builder().uid(eventUid).enrollment(enrollmentUid).lastUpdated(null) - .program(programUid).programStage(programStageUid).organisationUnit(orgunitUid) - .eventDate(null).deleted(true).build(); - - EventStoreImpl.create(databaseAdapter).insert(event); - } - - private void setProgramIndicatorExpressionAsAverage(String expression) { - insertProgramIndicator(expression, AggregationType.AVERAGE); - } - - private void setProgramIndicatorExpressionAsLast(String expression) { - insertProgramIndicator(expression, AggregationType.LAST); - } - - private void insertProgramIndicator(String expression, AggregationType aggregationType) { - ProgramIndicator programIndicator = ProgramIndicator.builder().uid(programIndicatorUid) - .program(ObjectWithUid.create(programUid)).expression(expression).aggregationType(aggregationType).build(); - ProgramIndicatorStore.create(databaseAdapter).insert(programIndicator); - } - - private void insertTrackedEntityDataValue(String eventUid, String dataElementUid, String value) { - TrackedEntityDataValue trackedEntityDataValue = TrackedEntityDataValue.builder() - .event(eventUid) - .dataElement(dataElementUid) - .value(value).build(); - - TrackedEntityDataValueStoreImpl.create(databaseAdapter).insert(trackedEntityDataValue); - } - - private void insertTrackedEntityAttributeValue(String attributeUid, String value) { - TrackedEntityAttributeValue trackedEntityAttributeValue = TrackedEntityAttributeValue.builder() - .value(value).trackedEntityAttribute(attributeUid).trackedEntityInstance(teiUid).build(); - TrackedEntityAttributeValueStoreImpl.create(databaseAdapter).insert(trackedEntityAttributeValue); - } - - private String de(String programStageUid, String dataElementUid) { - return "#{" + programStageUid + "." + dataElementUid + "}"; - } - - private String att(String attributeUid) { - return "A{" + attributeUid + "}"; - } - - private String var(String variable) { - return "V{" + variable + "}"; - } - - private Date today() { - return new Date(); - } - - private Date twoDaysBefore() { - Long newTime = (new Date()).getTime() - (2 * 24 * 60 * 60 * 1000); - return new Date(newTime); - } -} \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramEndpointCallMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramEndpointCallMockIntegrationShould.java index 193b5fa134..2a7113f943 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramEndpointCallMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramEndpointCallMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.program.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramEndpointCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramEndpointCallRealIntegrationShould.java index 7e2385c6a0..f03dbf4fbf 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramEndpointCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramEndpointCallRealIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.program.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramIndicatorStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramIndicatorStoreIntegrationShould.java index 879d21ded5..19f4a5256a 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramIndicatorStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramIndicatorStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.program.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramOrganisationUnitLastUpdatedStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramOrganisationUnitLastUpdatedStoreIntegrationShould.java deleted file mode 100644 index 019627913b..0000000000 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramOrganisationUnitLastUpdatedStoreIntegrationShould.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2004-2019, 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.program.internal; - -import org.hisp.dhis.android.core.data.database.ObjectWithoutUidStoreAbstractIntegrationShould; -import org.hisp.dhis.android.core.data.program.ProgramOrganisationUnitLastUpdatedSamples; -import org.hisp.dhis.android.core.utils.integration.mock.TestDatabaseAdapterFactory; -import org.hisp.dhis.android.core.utils.runner.D2JunitRunner; -import org.junit.runner.RunWith; - -import java.util.Date; - -@RunWith(D2JunitRunner.class) -public class ProgramOrganisationUnitLastUpdatedStoreIntegrationShould - extends ObjectWithoutUidStoreAbstractIntegrationShould { - - public ProgramOrganisationUnitLastUpdatedStoreIntegrationShould() { - super(ProgramOrganisationUnitLastUpdatedStore.create(TestDatabaseAdapterFactory.get()), - ProgramOrganisationUnitLastUpdatedTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); - } - - @Override - protected ProgramOrganisationUnitLastUpdated buildObject() { - return ProgramOrganisationUnitLastUpdatedSamples.get(); - } - - @Override - protected ProgramOrganisationUnitLastUpdated buildObjectToUpdate() { - return ProgramOrganisationUnitLastUpdatedSamples.get().toBuilder() - .lastSynced(new Date()) - .build(); - } -} \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramRuleActionStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramRuleActionStoreIntegrationShould.java index 967eaa9d47..88b4622b35 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramRuleActionStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramRuleActionStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.program.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramRuleStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramRuleStoreIntegrationShould.java index cd92797a3e..de68514649 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramRuleStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramRuleStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.program.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramRuleVariableStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramRuleVariableStoreIntegrationShould.java index 6f6d5061f9..8d6119444a 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramRuleVariableStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramRuleVariableStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.program.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramSectionAttributeLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramSectionAttributeLinkStoreIntegrationShould.java index 73adaec240..d11f6622c6 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramSectionAttributeLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramSectionAttributeLinkStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.program.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramSectionStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramSectionStoreIntegrationShould.java index d46beefb59..21dfcf1e15 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramSectionStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramSectionStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.program.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramStageDataElementStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramStageDataElementStoreIntegrationShould.java index 403e0ec55b..08683d9bad 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramStageDataElementStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramStageDataElementStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.program.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramStageSectionDataElementLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramStageSectionDataElementLinkStoreIntegrationShould.java index cbd28dcaab..f2aeebfa6e 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramStageSectionDataElementLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramStageSectionDataElementLinkStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.program.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramStageSectionStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramStageSectionStoreIntegrationShould.java index 7321d5217d..090a2fe7ca 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramStageSectionStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramStageSectionStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.program.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramStageStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramStageStoreIntegrationShould.java index 9d79eaab69..7678bde8b1 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramStageStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramStageStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.program.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramStoreIntegrationShould.java index 1848a1da4b..dce8f49691 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.program.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramTrackedEntityAttributeStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramTrackedEntityAttributeStoreIntegrationShould.java index 5e92f411c4..bb5a491a87 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramTrackedEntityAttributeStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/internal/ProgramTrackedEntityAttributeStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.program.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/program/programindicatorengine/ProgramIndicatorEngineIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/program/programindicatorengine/ProgramIndicatorEngineIntegrationShould.kt new file mode 100644 index 0000000000..1b431cf492 --- /dev/null +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/program/programindicatorengine/ProgramIndicatorEngineIntegrationShould.kt @@ -0,0 +1,401 @@ +/* + * Copyright (c) 2004-2021, 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.program.programindicatorengine + +import androidx.test.runner.AndroidJUnit4 +import com.google.common.truth.Truth.assertThat +import java.text.ParseException +import java.text.SimpleDateFormat +import java.util.* +import org.hisp.dhis.android.core.category.CategoryCombo +import org.hisp.dhis.android.core.category.CategoryComboTableInfo +import org.hisp.dhis.android.core.category.internal.CreateCategoryComboUtils +import org.hisp.dhis.android.core.common.* +import org.hisp.dhis.android.core.dataelement.DataElement +import org.hisp.dhis.android.core.dataelement.internal.DataElementStore +import org.hisp.dhis.android.core.enrollment.Enrollment +import org.hisp.dhis.android.core.enrollment.internal.EnrollmentStoreImpl +import org.hisp.dhis.android.core.event.Event +import org.hisp.dhis.android.core.event.internal.EventStoreImpl +import org.hisp.dhis.android.core.maintenance.D2Error +import org.hisp.dhis.android.core.organisationunit.OrganisationUnit +import org.hisp.dhis.android.core.organisationunit.internal.OrganisationUnitStore.create +import org.hisp.dhis.android.core.program.Program +import org.hisp.dhis.android.core.program.ProgramIndicator +import org.hisp.dhis.android.core.program.ProgramStage +import org.hisp.dhis.android.core.program.internal.ProgramIndicatorStore +import org.hisp.dhis.android.core.program.internal.ProgramStageStore +import org.hisp.dhis.android.core.program.internal.ProgramStore +import org.hisp.dhis.android.core.trackedentity.* +import org.hisp.dhis.android.core.trackedentity.internal.* +import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestEmptyDispatcher +import org.junit.After +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith + +@RunWith(AndroidJUnit4::class) +class ProgramIndicatorEngineIntegrationShould : BaseMockIntegrationTestEmptyDispatcher() { + + private val teiUid = "H87GEVeG3JH" + private val enrollmentUid = "la16vwCoFM8" + private val event1 = "gphKB0UjOrX" + private val event2 = "EAZOUgr2Ksv" + private val event3 = "BVL4LcEEDdU" + private val dataElement1 = "ddaBs9lgZyP" + private val dataElement2 = "Kb9hZ428FyH" + private val attribute1 = "Kmtdopp5GC1" + private val programIndicatorUid = "rg3JkCv0skl" + + // Auxiliary variables + private val orgunitUid = "orgunit_uid" + private val teiTypeUid = "tei_type_uid" + private val programUid = "program_uid" + private val programStage1 = "iM4svLr2hlO" + private val programStage2 = "RXFTSe1oefv" + private var programIndicatorEngine: ProgramIndicatorEngine? = null + + @Before + @Throws(Exception::class) + fun setUp() { + setUpClass() + programIndicatorEngine = d2.programModule().programIndicatorEngine() + + val orgunit = OrganisationUnit.builder().uid(orgunitUid).build() + create(databaseAdapter).insert(orgunit) + + val trackedEntityType = TrackedEntityType.builder().uid(teiTypeUid).build() + TrackedEntityTypeStore.create(databaseAdapter).insert(trackedEntityType) + + val teiStore = TrackedEntityInstanceStoreImpl.create(databaseAdapter) + val trackedEntityInstance = TrackedEntityInstance.builder() + .uid(teiUid) + .created(Date()) + .lastUpdated(Date()) + .organisationUnit(orgunitUid) + .trackedEntityType(teiTypeUid) + .build() + teiStore.insert(trackedEntityInstance) + + val categoryCombo = CreateCategoryComboUtils.create(1L, CategoryCombo.DEFAULT_UID) + databaseAdapter.insert(CategoryComboTableInfo.TABLE_INFO.name(), null, categoryCombo) + + val access = Access.create(true, false, DataAccess.create(true, true)) + val program = Program.builder().uid(programUid) + .access(access) + .trackedEntityType(TrackedEntityType.builder().uid(teiTypeUid).build()) + .build() + ProgramStore.create(databaseAdapter).insert(program) + + val stage1 = ProgramStage.builder().uid(programStage1).program(ObjectWithUid.create(programUid)) + .formType(FormType.CUSTOM).build() + val stage2 = ProgramStage.builder().uid(programStage2).program(ObjectWithUid.create(programUid)) + .formType(FormType.CUSTOM).build() + val programStageStore = ProgramStageStore.create(databaseAdapter) + programStageStore.insert(stage1) + programStageStore.insert(stage2) + + val de1 = DataElement.builder().uid(dataElement1).valueType(ValueType.NUMBER).build() + val de2 = DataElement.builder().uid(dataElement2).valueType(ValueType.NUMBER).build() + val dataElementStore = DataElementStore.create(databaseAdapter) + dataElementStore.insert(de1) + dataElementStore.insert(de2) + + val tea = TrackedEntityAttribute.builder().uid(attribute1).build() + TrackedEntityAttributeStore.create(databaseAdapter).insert(tea) + } + + @After + @Throws(D2Error::class) + fun tearDown() { + d2.wipeModule().wipeEverything() + } + + @Test + fun evaluate_single_dataelement() { + createEnrollment() + createTrackerEvent(eventUid = event1, programStageUid = programStage1, eventDate = Date()) + insertTrackedEntityDataValue(event1, dataElement1, "4") + setProgramIndicatorExpressionAsAvg(de(programStage1, dataElement1)) + val result = programIndicatorEngine!!.getEnrollmentProgramIndicatorValue(enrollmentUid, programIndicatorUid) + assertThat(result).isEqualTo("4") + } + + @Test + fun evaluate_single_text_dataelement() { + createEnrollment() + createTrackerEvent(eventUid = event1, programStageUid = programStage1, eventDate = Date()) + insertTrackedEntityDataValue(event1, dataElement1, "text data-value") + setProgramIndicatorExpressionAsAvg(de(programStage1, dataElement1)) + val result = programIndicatorEngine!!.getEnrollmentProgramIndicatorValue(enrollmentUid, programIndicatorUid) + assertThat(result).isEqualTo("text data-value") + } + + @Test + fun evaluate_addition_two_dataelement() { + createEnrollment() + createTrackerEvent(eventUid = event1, programStageUid = programStage1) + insertTrackedEntityDataValue(event1, dataElement1, "5") + insertTrackedEntityDataValue(event1, dataElement2, "3") + setProgramIndicatorExpressionAsAvg("${de(programStage1, dataElement1)} * ${de(programStage1, dataElement2)}") + val result = programIndicatorEngine!!.getEnrollmentProgramIndicatorValue(enrollmentUid, programIndicatorUid) + assertThat(result).isEqualTo("15") + } + + @Test + fun evaluate_division_two_dataelement() { + createEnrollment() + createTrackerEvent(eventUid = event1, programStageUid = programStage1) + insertTrackedEntityDataValue(event1, dataElement1, "3") + insertTrackedEntityDataValue(event1, dataElement2, "5") + setProgramIndicatorExpressionAsAvg("${de(programStage1, dataElement1)} / ${de(programStage1, dataElement2)}") + val result = programIndicatorEngine!!.getEnrollmentProgramIndicatorValue(enrollmentUid, programIndicatorUid) + assertThat(result).isEqualTo("0.6") + } + + @Test + fun evaluate_last_value_indicators_different_dates() { + createEnrollment() + createTrackerEvent( + eventUid = event1, programStageUid = programStage1, + eventDate = twoDaysBefore(), lastUpdated = today() + ) + createTrackerEvent( + eventUid = event2, programStageUid = programStage1, + eventDate = today(), lastUpdated = today() + ) + createTrackerEvent( + eventUid = event3, programStageUid = programStage1, + eventDate = twoDaysBefore(), lastUpdated = today() + ) + insertTrackedEntityDataValue(event1, dataElement1, "1") + insertTrackedEntityDataValue(event2, dataElement1, "2") // Expected as last value + insertTrackedEntityDataValue(event3, dataElement1, "3") + setProgramIndicatorExpressionAsLast(de(programStage1, dataElement1)) + val result = programIndicatorEngine!!.getEnrollmentProgramIndicatorValue(enrollmentUid, programIndicatorUid) + assertThat(result).isEqualTo("2") + } + + @Test + fun evaluate_last_value_indicators_same_date() { + createEnrollment() + val eventDate = twoDaysBefore() + createTrackerEvent( + eventUid = event1, programStageUid = programStage1, + eventDate = eventDate, lastUpdated = twoDaysBefore() + ) + createTrackerEvent( + eventUid = event2, programStageUid = programStage1, + eventDate = eventDate, lastUpdated = today() + ) + createTrackerEvent( + eventUid = event3, programStageUid = programStage1, + eventDate = eventDate, lastUpdated = twoDaysBefore() + ) + insertTrackedEntityDataValue(event1, dataElement1, "1") + insertTrackedEntityDataValue(event2, dataElement1, "2") // Expected as last value + insertTrackedEntityDataValue(event3, dataElement1, "3") + setProgramIndicatorExpressionAsLast(de(programStage1, dataElement1)) + val result = programIndicatorEngine!!.getEnrollmentProgramIndicatorValue(enrollmentUid, programIndicatorUid) + assertThat(result).isEqualTo("2") + } + + @Test + fun evaluate_operation_several_stages() { + createEnrollment() + createTrackerEvent(event1, programStage1) + createTrackerEvent(event2, programStage2) + insertTrackedEntityDataValue(event1, dataElement1, "5") + insertTrackedEntityDataValue(event2, dataElement2, "1.5") + insertTrackedEntityAttributeValue(attribute1, "2") + setProgramIndicatorExpressionAsAvg( + "(${de(programStage1, dataElement1)} + ${de(programStage2, dataElement2)})" + + " / ${att(attribute1)}" + ) + val enrollmentValue = programIndicatorEngine!!.getEnrollmentProgramIndicatorValue( + enrollmentUid, + programIndicatorUid + ) + val event1Value = programIndicatorEngine!!.getEventProgramIndicatorValue(event1, programIndicatorUid) + val event2Value = programIndicatorEngine!!.getEventProgramIndicatorValue(event2, programIndicatorUid) + assertThat(enrollmentValue).isEqualTo("3.25") + assertThat(event1Value).isEqualTo("2.5") + assertThat(event2Value).isEqualTo("0.75") + } + + @Test + fun evaluate_event_count_variable() { + createEnrollment() + createTrackerEvent(event1, programStage1) + createTrackerEvent(event2, programStage2) + createTrackerEvent(event3, programStage2, deleted = true) + setProgramIndicatorExpressionAsAvg(`var`("event_count")) + val result = programIndicatorEngine!!.getEnrollmentProgramIndicatorValue( + enrollmentUid, + programIndicatorUid + ) + assertThat(result).isEqualTo("2") + } + + @Test + fun evaluate_expression_with_d2_functions() { + createEnrollment() + createTrackerEvent(event1, programStage1) + insertTrackedEntityDataValue(event1, dataElement1, "4.8") + insertTrackedEntityDataValue(event1, dataElement2, "3") + setProgramIndicatorExpressionAsAvg( + "d2:round(${de(programStage1, dataElement1)}) * ${de(programStage1, dataElement2)}" + ) + val result = programIndicatorEngine!!.getEnrollmentProgramIndicatorValue(enrollmentUid, programIndicatorUid) + assertThat(result).isEqualTo("15") + } + + @Test + @Throws(ParseException::class) + fun evaluate_d2_functions_with_dates() { + val enrollmentDate = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS").parse("2018-05-05T00:00:00.000") + val incidentDate = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS").parse("2018-05-21T00:00:00.000") + createEnrollment(enrollmentDate, incidentDate) + setProgramIndicatorExpressionAsAvg("d2:daysBetween(V{enrollment_date}, V{incident_date})") + val result = programIndicatorEngine!!.getEnrollmentProgramIndicatorValue(enrollmentUid, programIndicatorUid) + assertThat(result).isEqualTo("16") + } + + @Test + fun evaluate_single_event() { + createSingleEvent(eventUid = event1, programStageUid = programStage1) + insertTrackedEntityDataValue(event1, dataElement1, "3.0") + insertTrackedEntityDataValue(event1, dataElement2, "4.0") + setProgramIndicatorExpressionAsLast("${de(programStage1, dataElement1)} + ${de(programStage1, dataElement2)}") + val result = programIndicatorEngine!!.getEventProgramIndicatorValue(event1, programIndicatorUid) + assertThat(result).isEqualTo("7") + } + + private fun createEnrollment(enrollmentDate: Date? = null, incidentDate: Date? = null) { + val enrollment = Enrollment.builder().uid(enrollmentUid).organisationUnit(orgunitUid).program(programUid) + .enrollmentDate(enrollmentDate).incidentDate(incidentDate).trackedEntityInstance(teiUid).build() + EnrollmentStoreImpl.create(databaseAdapter).insert(enrollment) + } + + private fun createEvent( + eventUid: String, + programStageUid: String, + enrollmentUid: String? = null, + deleted: Boolean = false, + eventDate: Date?, + lastUpdated: Date? = null + ) { + val event = Event.builder().uid(eventUid).enrollment(enrollmentUid).lastUpdated(lastUpdated) + .program(programUid).programStage(programStageUid).organisationUnit(orgunitUid) + .eventDate(eventDate).deleted(deleted).build() + EventStoreImpl.create(databaseAdapter).insert(event) + } + + private fun createTrackerEvent( + eventUid: String, + programStageUid: String, + deleted: Boolean = false, + eventDate: Date? = null, + lastUpdated: Date? = null + ) { + createEvent( + eventUid = eventUid, + programStageUid = programStageUid, + enrollmentUid = enrollmentUid, + deleted = deleted, + eventDate = eventDate, + lastUpdated = lastUpdated + ) + } + + private fun createSingleEvent( + eventUid: String, + programStageUid: String, + deleted: Boolean = false, + eventDate: Date? = null, + lastUpdated: Date? = null + ) { + createEvent( + eventUid = eventUid, + programStageUid = programStageUid, + enrollmentUid = null, + deleted = deleted, + eventDate = eventDate, + lastUpdated = lastUpdated + ) + } + + private fun setProgramIndicatorExpressionAsAvg(expression: String) { + insertProgramIndicator(expression, AggregationType.AVERAGE) + } + + private fun setProgramIndicatorExpressionAsLast(expression: String) { + insertProgramIndicator(expression, AggregationType.LAST) + } + + private fun insertProgramIndicator(expression: String, aggregationType: AggregationType) { + val programIndicator = ProgramIndicator.builder().uid(programIndicatorUid) + .program(ObjectWithUid.create(programUid)).expression(expression).aggregationType(aggregationType).build() + ProgramIndicatorStore.create(databaseAdapter).insert(programIndicator) + } + + private fun insertTrackedEntityDataValue(eventUid: String, dataElementUid: String, value: String) { + val trackedEntityDataValue = TrackedEntityDataValue.builder() + .event(eventUid) + .dataElement(dataElementUid) + .value(value).build() + TrackedEntityDataValueStoreImpl.create(databaseAdapter).insert(trackedEntityDataValue) + } + + private fun insertTrackedEntityAttributeValue(attributeUid: String, value: String) { + val trackedEntityAttributeValue = TrackedEntityAttributeValue.builder() + .value(value).trackedEntityAttribute(attributeUid).trackedEntityInstance(teiUid).build() + TrackedEntityAttributeValueStoreImpl.create(databaseAdapter).insert(trackedEntityAttributeValue) + } + + private fun de(programStageUid: String, dataElementUid: String): String { + return "#{$programStageUid.$dataElementUid}" + } + + private fun att(attributeUid: String): String { + return "A{$attributeUid}" + } + + private fun `var`(variable: String): String { + return "V{$variable}" + } + + private fun today(): Date { + return Date() + } + + private fun twoDaysBefore(): Date { + val newTime = Date().time - 2 * 24 * 60 * 60 * 1000 + return Date(newTime) + } +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/CreateRelationshipTypeUtils.java b/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/CreateRelationshipTypeUtils.java index 6b86a6d0e7..fdcc44be78 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/CreateRelationshipTypeUtils.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/CreateRelationshipTypeUtils.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.relationship; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/RelationshipCollectionRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/RelationshipCollectionRepositoryMockIntegrationShould.java index a0792a5aee..a7548b18f3 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/RelationshipCollectionRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/RelationshipCollectionRepositoryMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.relationship; @@ -37,8 +37,7 @@ import java.text.ParseException; import java.util.List; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) public class RelationshipCollectionRepositoryMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { @@ -49,7 +48,7 @@ public void find_all() { d2.relationshipModule().relationships() .blockingGet(); - assertThat(relationships.size(), is(2)); + assertThat(relationships.size()).isEqualTo(3); } @Test @@ -59,7 +58,7 @@ public void filter_by_uid() { .byUid().eq("AJOytZW7OaI") .blockingGet(); - assertThat(relationships.size(), is(1)); + assertThat(relationships.size()).isEqualTo(1); } @Test @@ -69,7 +68,7 @@ public void filter_by_name() { .byName().eq("Lab Sample to Person") .blockingGet(); - assertThat(relationships.size(), is(1)); + assertThat(relationships.size()).isEqualTo(1); } @Test @@ -79,7 +78,7 @@ public void filter_by_created() throws ParseException { .byCreated().eq(BaseNameableObject.DATE_FORMAT.parse("2019-02-07T08:06:28.369")) .blockingGet(); - assertThat(relationships.size(), is(1)); + assertThat(relationships.size()).isEqualTo(1); } @Test @@ -89,7 +88,7 @@ public void filter_by_last_updated() throws ParseException { .byLastUpdated().eq(BaseNameableObject.DATE_FORMAT.parse("2018-02-07T08:06:28.369")) .blockingGet(); - assertThat(relationships.size(), is(1)); + assertThat(relationships.size()).isEqualTo(1); } @Test @@ -99,7 +98,7 @@ public void filter_by_relationship_type() { .byRelationshipType().eq("V2kkHafqs8G") .blockingGet(); - assertThat(relationships.size(), is(1)); + assertThat(relationships.size()).isEqualTo(1); } @Test @@ -107,7 +106,7 @@ public void get_by_item() { RelationshipItem item = RelationshipItem.builder().trackedEntityInstance( RelationshipItemTrackedEntityInstance.builder().trackedEntityInstance("nWrB0TfWlvh").build()).build(); List relationships = d2.relationshipModule().relationships().getByItem(item); - assertThat(relationships.size(), is(4)); + assertThat(relationships.size()).isEqualTo(4); } @Test @@ -117,7 +116,7 @@ public void filter_by_object_repository() { .uid("AJOytZW7OaB") .blockingGet(); - assertThat(relationship.uid(), is("AJOytZW7OaB")); + assertThat(relationship.uid()).isEqualTo("AJOytZW7OaB"); } } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/internal/RelationshipConstraintStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/internal/RelationshipConstraintStoreIntegrationShould.java index 8ca8004f5f..62401f784a 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/internal/RelationshipConstraintStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/internal/RelationshipConstraintStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.relationship.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/internal/RelationshipItemStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/internal/RelationshipItemStoreIntegrationShould.java index b6706d2ac1..0f5b547f27 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/internal/RelationshipItemStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/internal/RelationshipItemStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.relationship.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/internal/RelationshipStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/internal/RelationshipStoreIntegrationShould.java index 517337ea2c..bcd33eb9bd 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/internal/RelationshipStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/relationship/internal/RelationshipStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.relationship.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/resource/internal/ResourceStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/resource/internal/ResourceStoreIntegrationShould.java index f0bb87e9c5..fe7e90456c 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/resource/internal/ResourceStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/resource/internal/ResourceStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.resource.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/settings/SettingsModuleMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/settings/SettingsModuleMockIntegrationShould.java index 5e410c1ce9..c7b45d25c5 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/settings/SettingsModuleMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/settings/SettingsModuleMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.settings; @@ -35,8 +35,7 @@ import java.util.List; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) public class SettingsModuleMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { @@ -44,44 +43,44 @@ public class SettingsModuleMockIntegrationShould extends BaseMockIntegrationTest @Test public void allow_access_to_system_setting() { List systemSettings = d2.settingModule().systemSetting().blockingGet(); - assertThat(systemSettings.size(), is(2)); + assertThat(systemSettings.size()).isEqualTo(2); } @Test public void allow_access_to_system_setting_filtered_by_key() { List systemSettingsFlag = d2.settingModule().systemSetting().byKey() .eq(SystemSetting.SystemSettingKey.FLAG).blockingGet(); - assertThat(systemSettingsFlag.size(), is(1)); - assertThat(systemSettingsFlag.get(0).value(), is("sierra_leone")); + assertThat(systemSettingsFlag.size()).isEqualTo(1); + assertThat(systemSettingsFlag.get(0).value()).isEqualTo("sierra_leone"); List systemSettingsStyle = d2.settingModule().systemSetting().byKey() .eq(SystemSetting.SystemSettingKey.STYLE).blockingGet(); - assertThat(systemSettingsStyle.get(0).value(), is("light_blue/light_blue.css")); + assertThat(systemSettingsStyle.get(0).value()).isEqualTo("light_blue/light_blue.css"); } @Test public void allow_access_to_system_setting_filtered_by_value() { List systemSettingsFlag = d2.settingModule().systemSetting().byValue() .eq("sierra_leone").blockingGet(); - assertThat(systemSettingsFlag.size(), is(1)); - assertThat(systemSettingsFlag.get(0).key(), is(SystemSetting.SystemSettingKey.FLAG)); + assertThat(systemSettingsFlag.size()).isEqualTo(1); + assertThat(systemSettingsFlag.get(0).key()).isEqualTo(SystemSetting.SystemSettingKey.FLAG); List systemSettingsStyle = d2.settingModule().systemSetting().byValue() .eq("light_blue/light_blue.css").blockingGet(); - assertThat(systemSettingsStyle.get(0).key(), is(SystemSetting.SystemSettingKey.STYLE)); + assertThat(systemSettingsStyle.get(0).key()).isEqualTo(SystemSetting.SystemSettingKey.STYLE); } @Test public void allow_access_to_flag_settings() { SystemSetting systemSetting = d2.settingModule().systemSetting().flag().blockingGet(); - assertThat(systemSetting.key(), is(SystemSetting.SystemSettingKey.FLAG)); - assertThat(systemSetting.value(), is("sierra_leone")); + assertThat(systemSetting.key()).isEqualTo(SystemSetting.SystemSettingKey.FLAG); + assertThat(systemSetting.value()).isEqualTo("sierra_leone"); } @Test public void allow_access_to_style_settings() { SystemSetting systemSetting = d2.settingModule().systemSetting().style().blockingGet(); - assertThat(systemSetting.key(), is(SystemSetting.SystemSettingKey.STYLE)); - assertThat(systemSetting.value(), is("light_blue/light_blue.css")); + assertThat(systemSetting.key()).isEqualTo(SystemSetting.SystemSettingKey.STYLE); + assertThat(systemSetting.value()).isEqualTo("light_blue/light_blue.css"); } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/AnalyticsTeiAttributeStoreIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/AnalyticsTeiAttributeStoreIntegrationShould.kt new file mode 100644 index 0000000000..5a704e1c1b --- /dev/null +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/AnalyticsTeiAttributeStoreIntegrationShould.kt @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2004-2021, 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.settings.internal + +import org.hisp.dhis.android.core.data.database.ObjectStoreAbstractIntegrationShould +import org.hisp.dhis.android.core.data.settings.AnalyticsSettingsSamples +import org.hisp.dhis.android.core.settings.AnalyticsTeiAttribute +import org.hisp.dhis.android.core.settings.AnalyticsTeiAttributeTableInfo +import org.hisp.dhis.android.core.utils.integration.mock.TestDatabaseAdapterFactory +import org.hisp.dhis.android.core.utils.runner.D2JunitRunner +import org.junit.runner.RunWith + +@RunWith(D2JunitRunner::class) +class AnalyticsTeiAttributeStoreIntegrationShould : ObjectStoreAbstractIntegrationShould( + AnalyticsTeiAttributeStore.create(TestDatabaseAdapterFactory.get()), + AnalyticsTeiAttributeTableInfo.TABLE_INFO, + TestDatabaseAdapterFactory.get() +) { + override fun buildObject(): AnalyticsTeiAttribute { + return AnalyticsSettingsSamples.analyticsTeiAttribute + } +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/AnalyticsTeiDataElementStoreIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/AnalyticsTeiDataElementStoreIntegrationShould.kt new file mode 100644 index 0000000000..de96b274f3 --- /dev/null +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/AnalyticsTeiDataElementStoreIntegrationShould.kt @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2004-2021, 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.settings.internal + +import org.hisp.dhis.android.core.data.database.ObjectStoreAbstractIntegrationShould +import org.hisp.dhis.android.core.data.settings.AnalyticsSettingsSamples +import org.hisp.dhis.android.core.settings.AnalyticsTeiDataElement +import org.hisp.dhis.android.core.settings.AnalyticsTeiDataElementTableInfo +import org.hisp.dhis.android.core.utils.integration.mock.TestDatabaseAdapterFactory +import org.hisp.dhis.android.core.utils.runner.D2JunitRunner +import org.junit.runner.RunWith + +@RunWith(D2JunitRunner::class) +class AnalyticsTeiDataElementStoreIntegrationShould : ObjectStoreAbstractIntegrationShould( + AnalyticsTeiDataElementStore.create(TestDatabaseAdapterFactory.get()), + AnalyticsTeiDataElementTableInfo.TABLE_INFO, + TestDatabaseAdapterFactory.get() +) { + override fun buildObject(): AnalyticsTeiDataElement { + return AnalyticsSettingsSamples.analyticsTeiDataElementSample + } +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/AnalyticsTeiIndicatorStoreIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/AnalyticsTeiIndicatorStoreIntegrationShould.kt new file mode 100644 index 0000000000..57865c850d --- /dev/null +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/AnalyticsTeiIndicatorStoreIntegrationShould.kt @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2004-2021, 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.settings.internal + +import org.hisp.dhis.android.core.data.database.ObjectStoreAbstractIntegrationShould +import org.hisp.dhis.android.core.data.settings.AnalyticsSettingsSamples +import org.hisp.dhis.android.core.settings.AnalyticsTeiIndicator +import org.hisp.dhis.android.core.settings.AnalyticsTeiIndicatorTableInfo +import org.hisp.dhis.android.core.utils.integration.mock.TestDatabaseAdapterFactory +import org.hisp.dhis.android.core.utils.runner.D2JunitRunner +import org.junit.runner.RunWith + +@RunWith(D2JunitRunner::class) +class AnalyticsTeiIndicatorStoreIntegrationShould : ObjectStoreAbstractIntegrationShould( + AnalyticsTeiIndicatorStore.create(TestDatabaseAdapterFactory.get()), + AnalyticsTeiIndicatorTableInfo.TABLE_INFO, + TestDatabaseAdapterFactory.get() +) { + override fun buildObject(): AnalyticsTeiIndicator { + return AnalyticsSettingsSamples.analyticsTeiIndicator + } +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/AnalyticsTeiSettingStoreIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/AnalyticsTeiSettingStoreIntegrationShould.kt new file mode 100644 index 0000000000..7a2b38b3dc --- /dev/null +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/AnalyticsTeiSettingStoreIntegrationShould.kt @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2004-2021, 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.settings.internal + +import org.hisp.dhis.android.core.data.database.ObjectStoreAbstractIntegrationShould +import org.hisp.dhis.android.core.data.settings.AnalyticsSettingsSamples +import org.hisp.dhis.android.core.settings.AnalyticsTeiSetting +import org.hisp.dhis.android.core.settings.AnalyticsTeiSettingTableInfo +import org.hisp.dhis.android.core.utils.integration.mock.TestDatabaseAdapterFactory +import org.hisp.dhis.android.core.utils.runner.D2JunitRunner +import org.junit.runner.RunWith + +@RunWith(D2JunitRunner::class) +class AnalyticsTeiSettingStoreIntegrationShould : ObjectStoreAbstractIntegrationShould( + AnalyticsTeiSettingStore.create(TestDatabaseAdapterFactory.get()), + AnalyticsTeiSettingTableInfo.TABLE_INFO, + TestDatabaseAdapterFactory.get() +) { + override fun buildObject(): AnalyticsTeiSetting { + return AnalyticsSettingsSamples.analyticsTeiSetting + } +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/AnalyticsTeiWHONutritionDataStoreIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/AnalyticsTeiWHONutritionDataStoreIntegrationShould.kt new file mode 100644 index 0000000000..7cd6733828 --- /dev/null +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/AnalyticsTeiWHONutritionDataStoreIntegrationShould.kt @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2004-2021, 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.settings.internal + +import org.hisp.dhis.android.core.data.database.ObjectStoreAbstractIntegrationShould +import org.hisp.dhis.android.core.data.settings.AnalyticsSettingsSamples +import org.hisp.dhis.android.core.settings.AnalyticsTeiWHONutritionData +import org.hisp.dhis.android.core.settings.AnalyticsTeiWHONutritionDataTableInfo +import org.hisp.dhis.android.core.utils.integration.mock.TestDatabaseAdapterFactory +import org.hisp.dhis.android.core.utils.runner.D2JunitRunner +import org.junit.runner.RunWith + +@RunWith(D2JunitRunner::class) +class AnalyticsTeiWHONutritionDataStoreIntegrationShould : + ObjectStoreAbstractIntegrationShould( + + AnalyticsTeiWHONutritionDataStore.create(TestDatabaseAdapterFactory.get()), + AnalyticsTeiWHONutritionDataTableInfo.TABLE_INFO, + TestDatabaseAdapterFactory.get() + ) { + override fun buildObject(): AnalyticsTeiWHONutritionData { + return AnalyticsSettingsSamples.analyticsTeiWHONutritionData + } +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/DataSetSettingStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/DataSetSettingStoreIntegrationShould.java index 3c6b90afc9..aaa36b2f22 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/DataSetSettingStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/DataSetSettingStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.settings.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/FilterSettingStoreIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/FilterSettingStoreIntegrationShould.kt new file mode 100644 index 0000000000..d5d50e4a66 --- /dev/null +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/FilterSettingStoreIntegrationShould.kt @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2004-2021, 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.settings.internal + +import org.hisp.dhis.android.core.data.database.ObjectStoreAbstractIntegrationShould +import org.hisp.dhis.android.core.data.settings.FilterSettingSamples +import org.hisp.dhis.android.core.settings.FilterSetting +import org.hisp.dhis.android.core.settings.FilterSettingTableInfo +import org.hisp.dhis.android.core.utils.integration.mock.TestDatabaseAdapterFactory +import org.hisp.dhis.android.core.utils.runner.D2JunitRunner +import org.junit.runner.RunWith + +@RunWith(D2JunitRunner::class) +class FilterSettingStoreIntegrationShould : ObjectStoreAbstractIntegrationShould( + FilterSettingStore.create(TestDatabaseAdapterFactory.get()), + FilterSettingTableInfo.TABLE_INFO, + TestDatabaseAdapterFactory.get() +) { + override fun buildObject(): FilterSetting { + return FilterSettingSamples.getFilterSetting() + } +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/GeneralSettingsStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/GeneralSettingsStoreIntegrationShould.java deleted file mode 100644 index 00e1b7a576..0000000000 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/GeneralSettingsStoreIntegrationShould.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2004-2019, 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.settings.internal; - -import org.hisp.dhis.android.core.data.database.ObjectStoreAbstractIntegrationShould; -import org.hisp.dhis.android.core.data.settings.GeneralSettingsSamples; -import org.hisp.dhis.android.core.settings.GeneralSettings; -import org.hisp.dhis.android.core.settings.GeneralSettingTableInfo; -import org.hisp.dhis.android.core.utils.integration.mock.TestDatabaseAdapterFactory; -import org.hisp.dhis.android.core.utils.runner.D2JunitRunner; -import org.junit.runner.RunWith; - -@RunWith(D2JunitRunner.class) -public class GeneralSettingsStoreIntegrationShould - extends ObjectStoreAbstractIntegrationShould { - - public GeneralSettingsStoreIntegrationShould() { - super(GeneralSettingStore.create(TestDatabaseAdapterFactory.get()), GeneralSettingTableInfo.TABLE_INFO, - TestDatabaseAdapterFactory.get()); - } - - @Override - protected GeneralSettings buildObject() { - return GeneralSettingsSamples.getGeneralSettings(); - } -} \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/GeneralSettingsStoreIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/GeneralSettingsStoreIntegrationShould.kt new file mode 100644 index 0000000000..8b530a21dc --- /dev/null +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/GeneralSettingsStoreIntegrationShould.kt @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2004-2021, 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.settings.internal + +import org.hisp.dhis.android.core.data.database.ObjectStoreAbstractIntegrationShould +import org.hisp.dhis.android.core.data.settings.GeneralSettingsSamples +import org.hisp.dhis.android.core.settings.GeneralSettingTableInfo +import org.hisp.dhis.android.core.settings.GeneralSettings +import org.hisp.dhis.android.core.utils.integration.mock.TestDatabaseAdapterFactory +import org.hisp.dhis.android.core.utils.runner.D2JunitRunner +import org.junit.runner.RunWith + +@RunWith(D2JunitRunner::class) +class GeneralSettingsStoreIntegrationShould : ObjectStoreAbstractIntegrationShould( + GeneralSettingStore.create(TestDatabaseAdapterFactory.get()), + GeneralSettingTableInfo.TABLE_INFO, + TestDatabaseAdapterFactory.get() +) { + override fun buildObject(): GeneralSettings { + return GeneralSettingsSamples.getGeneralSettings() + } +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/ProgramSettingStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/ProgramSettingStoreIntegrationShould.java index 19c1e5773e..4082dab11a 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/ProgramSettingStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/ProgramSettingStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.settings.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/SynchronizationSettingsStoreIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/SynchronizationSettingsStoreIntegrationShould.kt new file mode 100644 index 0000000000..1d428695a0 --- /dev/null +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/SynchronizationSettingsStoreIntegrationShould.kt @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2004-2021, 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.settings.internal + +import org.hisp.dhis.android.core.data.database.ObjectStoreAbstractIntegrationShould +import org.hisp.dhis.android.core.data.settings.SynchronizationSettingsSamples +import org.hisp.dhis.android.core.settings.SynchronizationSettingTableInfo +import org.hisp.dhis.android.core.settings.SynchronizationSettings +import org.hisp.dhis.android.core.utils.integration.mock.TestDatabaseAdapterFactory +import org.hisp.dhis.android.core.utils.runner.D2JunitRunner +import org.junit.runner.RunWith + +@RunWith(D2JunitRunner::class) +class SynchronizationSettingsStoreIntegrationShould : ObjectStoreAbstractIntegrationShould( + SynchronizationSettingStore.create(TestDatabaseAdapterFactory.get()), + SynchronizationSettingTableInfo.TABLE_INFO, + TestDatabaseAdapterFactory.get() +) { + override fun buildObject(): SynchronizationSettings { + return SynchronizationSettingsSamples.getSynchronizationSettings() + } +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/SystemSettingStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/SystemSettingStoreIntegrationShould.java index 5f666286eb..761a993821 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/SystemSettingStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/SystemSettingStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.settings.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/UserSettingsStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/UserSettingsStoreIntegrationShould.java index 89223afa09..cfd46e9f0b 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/UserSettingsStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/settings/internal/UserSettingsStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.settings.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/systeminfo/DHISVersionsManagerRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/systeminfo/DHISVersionsManagerRealIntegrationShould.java index be169f6812..f0ad978a84 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/systeminfo/DHISVersionsManagerRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/systeminfo/DHISVersionsManagerRealIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.systeminfo; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/systeminfo/SystemInfoCallMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/systeminfo/SystemInfoCallMockIntegrationShould.java index ac2154c574..b3dd31f2f3 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/systeminfo/SystemInfoCallMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/systeminfo/SystemInfoCallMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.systeminfo; @@ -58,7 +58,7 @@ public static void setUpClass() throws Exception { @Before public void setUp() { - dhis2MockServer.enqueueMockResponse("systeminfo/system_info.json"); + dhis2MockServer.enqueueSystemInfoResponse(); databaseAdapter.delete(tableInfo.name(), "1", new String[]{}); } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/systeminfo/SystemInfoDatabaseMappingShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/systeminfo/SystemInfoDatabaseMappingShould.java index 3ef6298ab3..259c0b44d3 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/systeminfo/SystemInfoDatabaseMappingShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/systeminfo/SystemInfoDatabaseMappingShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.systeminfo; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/systeminfo/SystemInfoModuleMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/systeminfo/SystemInfoModuleMockIntegrationShould.java index 64ab04f01c..01aadde857 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/systeminfo/SystemInfoModuleMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/systeminfo/SystemInfoModuleMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.systeminfo; @@ -33,8 +33,7 @@ import org.junit.Test; import org.junit.runner.RunWith; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) public class SystemInfoModuleMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { @@ -42,7 +41,7 @@ public class SystemInfoModuleMockIntegrationShould extends BaseMockIntegrationTe @Test public void allow_access_to_system_info_user() { SystemInfo systemInfo = d2.systemInfoModule().systemInfo().blockingGet(); - assertThat(systemInfo.version(), is("2.30")); - assertThat(systemInfo.systemName(), is("DHIS 2 Demo - Sierra Leone")); + assertThat(systemInfo.version()).isEqualTo("2.35"); + assertThat(systemInfo.systemName()).isEqualTo("DHIS 2 Demo - Sierra Leone"); } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/systeminfo/internal/SystemInfoStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/systeminfo/internal/SystemInfoStoreIntegrationShould.java index fb6f7d9013..a1bb0941df 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/systeminfo/internal/SystemInfoStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/systeminfo/internal/SystemInfoStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.systeminfo.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/CreateTrackedEntityAttributeUtils.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/CreateTrackedEntityAttributeUtils.java index 7221fd64cb..263930212e 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/CreateTrackedEntityAttributeUtils.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/CreateTrackedEntityAttributeUtils.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.trackedentity; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/CreateTrackedEntityInstanceUtils.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/CreateTrackedEntityInstanceUtils.java index 3c86387741..0e8e499a51 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/CreateTrackedEntityInstanceUtils.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/CreateTrackedEntityInstanceUtils.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.trackedentity; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/CreateTrackedEntityUtils.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/CreateTrackedEntityUtils.java index ad7769ca7f..2abe779e31 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/CreateTrackedEntityUtils.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/CreateTrackedEntityUtils.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.trackedentity; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityAttributeReservedValueManagerRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityAttributeReservedValueManagerRealIntegrationShould.java index b7315fc15e..2089985b41 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityAttributeReservedValueManagerRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityAttributeReservedValueManagerRealIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.trackedentity; @@ -64,10 +64,9 @@ import java.util.List; import java.util.concurrent.Callable; -import static org.hamcrest.CoreMatchers.is; +import static com.google.common.truth.Truth.assertThat; import static org.hisp.dhis.android.core.data.utils.FillPropertiesTestUtils.CREATED; import static org.hisp.dhis.android.core.data.utils.FillPropertiesTestUtils.FUTURE_DATE; -import static org.junit.Assert.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -173,11 +172,11 @@ public void setUp() throws IOException { // @Test public void get_one_reserved_value() throws D2Error { - assertThat(selectAll().size(), is(3)); + assertThat(selectAll().size()).isEqualTo(3); String value1 = d2.trackedEntityModule().reservedValueManager().blockingGetValue(ownerUid, organisationUnitUid); - assertThat(value1, is("value1")); + assertThat(value1).isEqualTo("value1"); } // @Test @@ -186,85 +185,85 @@ public void get_more_than_one_reserved_value() throws D2Error { String value2 = d2.trackedEntityModule().reservedValueManager().blockingGetValue(ownerUid, organisationUnitUid); String value3 = d2.trackedEntityModule().reservedValueManager().blockingGetValue(ownerUid, organisationUnitUid); - assertThat(value1, is("value1")); - assertThat(value2, is("value2")); - assertThat(value3, is("value3")); + assertThat(value1).isEqualTo("value1"); + assertThat(value2).isEqualTo("value2"); + assertThat(value3).isEqualTo("value3"); } // @Test public void sync_reserved_values_for_one_tracked_entity_attribute() { d2.trackedEntityModule().reservedValueManager().blockingDownloadReservedValues(ownerUid, 100); - assertThat(selectAll().size(), is(100)); + assertThat(selectAll().size()).isEqualTo(100); } // @Test public void sync_20_reserved_values_for_one_tracked_entity_attribute() { d2.trackedEntityModule().reservedValueManager().blockingDownloadReservedValues(ownerUid, 20); - assertThat(selectAll().size(), is(20)); + assertThat(selectAll().size()).isEqualTo(20); } // @Test public void sync_100_reserved_values_when_not_number_of_values_to_reserve_is_specified() { d2.trackedEntityModule().reservedValueManager().blockingDownloadReservedValues(ownerUid, null); - assertThat(selectAll().size(), is(100)); + assertThat(selectAll().size()).isEqualTo(100); } // @Test public void sync_pop_sync_again_and_have_99_reserved_values_when_not_number_of_values_to_reserve_is_specified() throws D2Error { d2.trackedEntityModule().reservedValueManager().blockingDownloadReservedValues(ownerUid, null); - assertThat(selectAll().size(), is(100)); + assertThat(selectAll().size()).isEqualTo(100); d2.trackedEntityModule().reservedValueManager().blockingGetValue(ownerUid, organisationUnitUid); - assertThat(selectAll().size(), is(99)); + assertThat(selectAll().size()).isEqualTo(99); d2.trackedEntityModule().reservedValueManager().blockingDownloadReservedValues(ownerUid, null); - assertThat(selectAll().size(), is(99)); + assertThat(selectAll().size()).isEqualTo(99); } // @Test public void fill_up_to_100_values_if_db_does_not_have_at_least_50_values_when_not_number_of_values_to_reserve_is_specified() throws D2Error { d2.trackedEntityModule().reservedValueManager().blockingDownloadReservedValues(ownerUid, 50); - assertThat(selectAll().size(), is(50)); + assertThat(selectAll().size()).isEqualTo(50); d2.trackedEntityModule().reservedValueManager().blockingDownloadReservedValues(ownerUid, null); - assertThat(selectAll().size(), is(50)); + assertThat(selectAll().size()).isEqualTo(50); d2.trackedEntityModule().reservedValueManager().blockingGetValue(ownerUid, organisationUnitUid); - assertThat(selectAll().size(), is(49)); + assertThat(selectAll().size()).isEqualTo(49); d2.trackedEntityModule().reservedValueManager().blockingDownloadReservedValues(ownerUid, null); - assertThat(selectAll().size(), is(100)); + assertThat(selectAll().size()).isEqualTo(100); } // @Test public void sync_pop_sync_again_and_have_99_reserved_values_if_less_than_existing_values_are_requested() throws D2Error { d2.trackedEntityModule().reservedValueManager().blockingDownloadReservedValues(ownerUid, 100); - assertThat(selectAll().size(), is(100)); + assertThat(selectAll().size()).isEqualTo(100); d2.trackedEntityModule().reservedValueManager().blockingGetValue(ownerUid, organisationUnitUid); - assertThat(selectAll().size(), is(99)); + assertThat(selectAll().size()).isEqualTo(99); d2.trackedEntityModule().reservedValueManager().blockingDownloadReservedValues(ownerUid, 20); - assertThat(selectAll().size(), is(99)); + assertThat(selectAll().size()).isEqualTo(99); } // @Test public void reserve_100_new_values_and_take_one() throws D2Error { d2.trackedEntityModule().reservedValueManager().blockingGetValue(ownerUid, organisationUnitUid); - assertThat(selectAll().size(), is(99)); + assertThat(selectAll().size()).isEqualTo(99); } // @Test public void have_98_values_after_sync_and_take_two() throws D2Error { d2.trackedEntityModule().reservedValueManager().blockingGetValue(ownerUid, organisationUnitUid); d2.trackedEntityModule().reservedValueManager().blockingGetValue(ownerUid, organisationUnitUid); - assertThat(selectAll().size(), is(98)); + assertThat(selectAll().size()).isEqualTo(98); } // @Test public void sync_all_tracked_entity_instances() throws Exception { - assertThat(selectAll().size(), is(3)); + assertThat(selectAll().size()).isEqualTo(3); d2.metadataModule().blockingDownload(); d2.trackedEntityModule().reservedValueManager().blockingDownloadAllReservedValues(null); /* 100 Reserved values by default * 2 TEA with generated property true on server = 200 */ - assertThat(selectAll().size(), is(200)); + assertThat(selectAll().size()).isEqualTo(200); } // @Test @@ -342,10 +341,10 @@ private void assertQueryIsCreatedRight(Integer numberOfValuesExpected) { verify(trackedEntityAttributeReservedValueQueryCallFactory).create(trackedEntityAttributeReservedValueQueryCaptor.capture()); TrackedEntityAttributeReservedValueQuery query = trackedEntityAttributeReservedValueQueryCaptor.getValue(); - assertThat(query.organisationUnit().uid(), is(organisationUnit.uid())); - assertThat(query.numberToReserve(), is(numberOfValuesExpected)); // values expected - 3 that it had before. - assertThat(query.trackedEntityAttributePattern(), is(pattern)); - assertThat(query.trackedEntityAttributeUid(), is(ownerUid)); + assertThat(query.organisationUnit().uid()).isEqualTo(organisationUnit.uid()); + assertThat(query.numberToReserve()).isEqualTo(numberOfValuesExpected); // values expected - 3 that it had before. + assertThat(query.trackedEntityAttributePattern()).isEqualTo(pattern); + assertThat(query.trackedEntityAttributeUid()).isEqualTo(ownerUid); } } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityInstanceCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityInstanceCallRealIntegrationShould.java index 9e94932861..3211a1b289 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityInstanceCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityInstanceCallRealIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.trackedentity; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityTypeCollectionRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityTypeCollectionRepositoryMockIntegrationShould.java index 0d613714d6..f2e361b8db 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityTypeCollectionRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/TrackedEntityTypeCollectionRepositoryMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.trackedentity; @@ -36,8 +36,7 @@ import java.util.List; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) public class TrackedEntityTypeCollectionRepositoryMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { @@ -46,14 +45,14 @@ public class TrackedEntityTypeCollectionRepositoryMockIntegrationShould extends public void allow_access_to_all_tracked_entity_types_without_children() { List trackedEntityTypes = d2.trackedEntityModule().trackedEntityTypes() .blockingGet(); - assertThat(trackedEntityTypes.size(), is(1)); + assertThat(trackedEntityTypes.size()).isEqualTo(1); } @Test public void include_attributes_as_children() { TrackedEntityType trackedEntityType = d2.trackedEntityModule().trackedEntityTypes() .withTrackedEntityTypeAttributes().one().blockingGet(); - assertThat(trackedEntityType.trackedEntityTypeAttributes().size(), is(1)); + assertThat(trackedEntityType.trackedEntityTypeAttributes().size()).isEqualTo(1); } @Test @@ -61,7 +60,7 @@ public void filter_by_feature_type() { List trackedEntityTypes = d2.trackedEntityModule().trackedEntityTypes() .byFeatureType().eq(FeatureType.NONE) .blockingGet(); - assertThat(trackedEntityTypes.size(), is(1)); + assertThat(trackedEntityTypes.size()).isEqualTo(1); } @Test @@ -69,7 +68,7 @@ public void filter_by_field_color() { List trackedEntityTypes = d2.trackedEntityModule().trackedEntityTypes() .byColor().eq("#000") .blockingGet(); - assertThat(trackedEntityTypes.size(), is(1)); + assertThat(trackedEntityTypes.size()).isEqualTo(1); } @Test @@ -77,6 +76,6 @@ public void filter_by_field_icon() { List trackedEntityTypes = d2.trackedEntityModule().trackedEntityTypes() .byIcon().eq("my-tracked-entity-attribute-icon-name") .blockingGet(); - assertThat(trackedEntityTypes.size(), is(1)); + assertThat(trackedEntityTypes.size()).isEqualTo(1); } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/api/BreakTheGlassAPIShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/api/BreakTheGlassAPIShould.java index 88cc67a6f4..63df0a05a7 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/api/BreakTheGlassAPIShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/api/BreakTheGlassAPIShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.trackedentity.api; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/api/TrackedEntityInstanceAPI29Should.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/api/TrackedEntityInstanceAPI29Should.java index 407496ce75..b8fc9d3e83 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/api/TrackedEntityInstanceAPI29Should.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/api/TrackedEntityInstanceAPI29Should.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.trackedentity.api; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/api/TrackedEntityInstanceAPI30Should.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/api/TrackedEntityInstanceAPI30Should.java index fd4a8e6b16..1bb79efd74 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/api/TrackedEntityInstanceAPI30Should.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/api/TrackedEntityInstanceAPI30Should.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.trackedentity.api; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/api/TrackedEntityInstanceAPIShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/api/TrackedEntityInstanceAPIShould.java index 8b1e81adb9..7eaa70c03c 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/api/TrackedEntityInstanceAPIShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/api/TrackedEntityInstanceAPIShould.java @@ -1,35 +1,33 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.trackedentity.api; -import junit.framework.Assert; - import org.hisp.dhis.android.core.BaseRealIntegrationTest; import org.hisp.dhis.android.core.D2; import org.hisp.dhis.android.core.D2Factory; @@ -51,6 +49,7 @@ import org.hisp.dhis.android.core.trackedentity.internal.TrackedEntityInstanceFields; import org.hisp.dhis.android.core.trackedentity.internal.TrackedEntityInstancePayload; import org.hisp.dhis.android.core.trackedentity.internal.TrackedEntityInstanceService; +import org.junit.Assert; import org.junit.Before; import java.io.IOException; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/api/TrackedEntityInstanceUtils.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/api/TrackedEntityInstanceUtils.java index af8881d6bb..233aa8dd0b 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/api/TrackedEntityInstanceUtils.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/api/TrackedEntityInstanceUtils.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.trackedentity.api; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/ReservedValueSettingStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/ReservedValueSettingStoreIntegrationShould.java new file mode 100644 index 0000000000..a93f72f7f6 --- /dev/null +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/ReservedValueSettingStoreIntegrationShould.java @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2004-2021, 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.trackedentity.internal; + +import org.hisp.dhis.android.core.data.database.IdentifiableObjectStoreAbstractIntegrationShould; +import org.hisp.dhis.android.core.data.trackedentity.ReservedValueSettingSamples; +import org.hisp.dhis.android.core.trackedentity.ReservedValueSetting; +import org.hisp.dhis.android.core.trackedentity.ReservedValueSettingTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.TestDatabaseAdapterFactory; +import org.hisp.dhis.android.core.utils.runner.D2JunitRunner; +import org.junit.runner.RunWith; + +@RunWith(D2JunitRunner.class) +public class ReservedValueSettingStoreIntegrationShould extends + IdentifiableObjectStoreAbstractIntegrationShould { + + public ReservedValueSettingStoreIntegrationShould() { + super(ReservedValueSettingStore.create(TestDatabaseAdapterFactory.get()), + ReservedValueSettingTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); + } + + @Override + protected ReservedValueSetting buildObject() { + return ReservedValueSettingSamples.get(); + } + + @Override + protected ReservedValueSetting buildObjectToUpdate() { + return ReservedValueSettingSamples.get().toBuilder() + .numberOfValuesToReserve(100) + .build(); + } +} \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityAttributeReservedValueEndpointCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityAttributeReservedValueEndpointCallRealIntegrationShould.java index f133ac7337..af18d375c5 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityAttributeReservedValueEndpointCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityAttributeReservedValueEndpointCallRealIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.trackedentity.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityAttributeReservedValueStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityAttributeReservedValueStoreIntegrationShould.java index fbcedeb849..8d27ff1310 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityAttributeReservedValueStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityAttributeReservedValueStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.trackedentity.internal; @@ -43,8 +43,7 @@ import java.util.Date; import java.util.List; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; +import static com.google.common.truth.Truth.assertThat; import static org.hisp.dhis.android.core.data.utils.FillPropertiesTestUtils.parseDate; @RunWith(JUnit4.class) @@ -130,7 +129,7 @@ public void not_delete_not_expired_reserved_values() { public void pop_inserted_value() { store.insert(notExpiredValue); TrackedEntityAttributeReservedValue returnedValue = store.popOne(ownerUid, orgUnitUid); - assertThat(returnedValue.value(), is(notExpiredValue.value())); + assertThat(returnedValue.value()).isEqualTo(notExpiredValue.value()); } @Test @@ -142,6 +141,6 @@ public void leave_store_empty_after_pop_only_value() { private void storeContains(TrackedEntityAttributeReservedValue value, Boolean contains) { List values = store.selectAll(); - assertThat(values.contains(value), is(contains)); + assertThat(values.contains(value)).isEqualTo(contains); } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityAttributeStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityAttributeStoreIntegrationShould.java index be78ddd243..7837fdf239 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityAttributeStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityAttributeStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.trackedentity.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityAttributeValueStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityAttributeValueStoreIntegrationShould.java index fbdb369a34..c4063ec176 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityAttributeValueStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityAttributeValueStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.trackedentity.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityDataValueStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityDataValueStoreIntegrationShould.java index d2bee4de7b..bd5d6115e4 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityDataValueStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityDataValueStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.trackedentity.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityInstanceCallMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityInstanceCallMockIntegrationShould.java index 5817f3be18..930755a420 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityInstanceCallMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityInstanceCallMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.trackedentity.internal; @@ -35,8 +35,8 @@ import org.hisp.dhis.android.core.arch.api.payload.internal.Payload; import org.hisp.dhis.android.core.arch.db.querybuilders.internal.WhereClauseBuilder; -import org.hisp.dhis.android.core.common.BaseIdentifiableObject; import org.hisp.dhis.android.core.arch.file.ResourcesFileReader; +import org.hisp.dhis.android.core.common.BaseIdentifiableObject; import org.hisp.dhis.android.core.enrollment.Enrollment; import org.hisp.dhis.android.core.enrollment.EnrollmentInternalAccessor; import org.hisp.dhis.android.core.enrollment.EnrollmentTableInfo; @@ -59,8 +59,7 @@ import java.util.List; import java.util.Map; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; public class TrackedEntityInstanceCallMockIntegrationShould extends BaseMockIntegrationTestMetadataEnqueable { @@ -69,7 +68,7 @@ public void download_tracked_entity_instance_enrollments_and_events() throws Exc String teiUid = "PgmUFEQYZdt"; - dhis2MockServer.enqueueMockResponse("systeminfo/system_info.json"); + dhis2MockServer.enqueueSystemInfoResponse(); dhis2MockServer.enqueueMockResponse("trackedentity/tracked_entity_instance_payload.json"); d2.trackedEntityModule().trackedEntityInstanceDownloader().byUid().eq(teiUid).blockingDownload(); @@ -82,12 +81,12 @@ public void remove_data_removed_in_server_after_second_download() throws Exception { String teiUid = "PgmUFEQYZdt"; - dhis2MockServer.enqueueMockResponse("systeminfo/system_info.json"); + dhis2MockServer.enqueueSystemInfoResponse(); dhis2MockServer.enqueueMockResponse("trackedentity/tracked_entity_instance_payload.json"); d2.trackedEntityModule().trackedEntityInstanceDownloader().byUid().eq(teiUid).blockingDownload(); - dhis2MockServer.enqueueMockResponse("systeminfo/system_info.json"); + dhis2MockServer.enqueueSystemInfoResponse(); dhis2MockServer.enqueueMockResponse("trackedentity/tracked_entity_instance_with_removed_data_payload.json"); d2.trackedEntityModule().trackedEntityInstanceDownloader().byUid().eq(teiUid).blockingDownload(); @@ -121,11 +120,11 @@ private void verifyDownloadedTrackedEntityInstancePayload(String file, String te TrackedEntityInstance downloadedTei = getDownloadedTei(teiUid); - assertThat(downloadedTei.uid(), is(expectedEnrollmentResponse.uid())); - assertThat(downloadedTei.trackedEntityAttributeValues().size(), - is(expectedEnrollmentResponse.trackedEntityAttributeValues().size())); - assertThat(getEnrollments(downloadedTei).size(), - is(getEnrollments(expectedEnrollmentResponse).size())); + assertThat(downloadedTei.uid()).isEqualTo(expectedEnrollmentResponse.uid()); + assertThat(downloadedTei.trackedEntityAttributeValues().size()) + .isEqualTo(expectedEnrollmentResponse.trackedEntityAttributeValues().size()); + assertThat(getEnrollments(downloadedTei).size()) + .isEqualTo(getEnrollments(expectedEnrollmentResponse).size()); } private void verifyDownloadedTrackedEntityInstance(String file, String teiUid) @@ -138,9 +137,9 @@ private void verifyDownloadedTrackedEntityInstance(String file, String teiUid) TrackedEntityInstance downloadedTei = getDownloadedTei(teiUid); - assertThat(downloadedTei.uid(), is(expectedEnrollmentResponse.uid())); - assertThat(downloadedTei.trackedEntityAttributeValues().size(), - is(expectedEnrollmentResponse.trackedEntityAttributeValues().size())); + assertThat(downloadedTei.uid()).isEqualTo(expectedEnrollmentResponse.uid()); + assertThat(downloadedTei.trackedEntityAttributeValues().size()) + .isEqualTo(expectedEnrollmentResponse.trackedEntityAttributeValues().size()); } private M parseTrackedEntityInstanceResponse(String file, TypeReference reference) diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityInstanceEventFilterStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityInstanceEventFilterStoreIntegrationShould.java new file mode 100644 index 0000000000..a590b0ada2 --- /dev/null +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityInstanceEventFilterStoreIntegrationShould.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2004-2021, 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.trackedentity.internal; + +import org.hisp.dhis.android.core.data.database.ObjectStoreAbstractIntegrationShould; +import org.hisp.dhis.android.core.data.trackedentity.TrackedEntityInstanceEventFilterSamples; +import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstanceEventFilter; +import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstanceEventFilterTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.TestDatabaseAdapterFactory; +import org.hisp.dhis.android.core.utils.runner.D2JunitRunner; +import org.junit.runner.RunWith; + +@RunWith(D2JunitRunner.class) +public class TrackedEntityInstanceEventFilterStoreIntegrationShould + extends ObjectStoreAbstractIntegrationShould { + + public TrackedEntityInstanceEventFilterStoreIntegrationShould() { + super(TrackedEntityInstanceEventFilterStore.create(TestDatabaseAdapterFactory.get()), + TrackedEntityInstanceEventFilterTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); + } + + @Override + protected TrackedEntityInstanceEventFilter buildObject() { + return TrackedEntityInstanceEventFilterSamples.get(); + } +} \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityInstanceFilterStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityInstanceFilterStoreIntegrationShould.java new file mode 100644 index 0000000000..0bf46636f0 --- /dev/null +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityInstanceFilterStoreIntegrationShould.java @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2004-2021, 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.trackedentity.internal; + +import org.hisp.dhis.android.core.data.database.IdentifiableObjectStoreAbstractIntegrationShould; +import org.hisp.dhis.android.core.data.trackedentity.TrackedEntityInstanceFilterSamples; +import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstanceFilter; +import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstanceFilterTableInfo; +import org.hisp.dhis.android.core.utils.integration.mock.TestDatabaseAdapterFactory; +import org.hisp.dhis.android.core.utils.runner.D2JunitRunner; +import org.junit.runner.RunWith; + +@RunWith(D2JunitRunner.class) +public class TrackedEntityInstanceFilterStoreIntegrationShould + extends IdentifiableObjectStoreAbstractIntegrationShould { + + public TrackedEntityInstanceFilterStoreIntegrationShould() { + super(TrackedEntityInstanceFilterStore.create(TestDatabaseAdapterFactory.get()), + TrackedEntityInstanceFilterTableInfo.TABLE_INFO, TestDatabaseAdapterFactory.get()); + } + + @Override + protected TrackedEntityInstanceFilter buildObject() { + return TrackedEntityInstanceFilterSamples.get(); + } + + @Override + protected TrackedEntityInstanceFilter buildObjectToUpdate() { + return TrackedEntityInstanceFilterSamples.get().toBuilder() + .description("new_description") + .build(); + } +} \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityInstancePostCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityInstancePostCallRealIntegrationShould.java index 7807924808..66a29c5d22 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityInstancePostCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityInstancePostCallRealIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.trackedentity.internal; @@ -39,6 +39,7 @@ import org.hisp.dhis.android.core.common.Geometry; import org.hisp.dhis.android.core.common.State; import org.hisp.dhis.android.core.enrollment.Enrollment; +import org.hisp.dhis.android.core.enrollment.EnrollmentCreateProjection; import org.hisp.dhis.android.core.enrollment.EnrollmentStatus; import org.hisp.dhis.android.core.enrollment.EnrollmentTableInfo; import org.hisp.dhis.android.core.enrollment.internal.EnrollmentStore; @@ -50,6 +51,8 @@ import org.hisp.dhis.android.core.maintenance.D2Error; import org.hisp.dhis.android.core.maintenance.D2ErrorCode; import org.hisp.dhis.android.core.maintenance.D2ErrorComponent; +import org.hisp.dhis.android.core.organisationunit.OrganisationUnit; +import org.hisp.dhis.android.core.program.Program; import org.hisp.dhis.android.core.relationship.Relationship; import org.hisp.dhis.android.core.relationship.RelationshipCollectionRepository; import org.hisp.dhis.android.core.relationship.RelationshipHelper; @@ -60,6 +63,7 @@ import org.hisp.dhis.android.core.trackedentity.TrackedEntityAttributeValue; import org.hisp.dhis.android.core.trackedentity.TrackedEntityDataValue; import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstance; +import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstanceCreateProjection; import org.junit.Before; import java.io.IOException; @@ -67,7 +71,6 @@ import java.util.List; import io.reactivex.observers.TestObserver; -import retrofit2.Response; import static com.google.common.truth.Truth.assertThat; @@ -143,8 +146,6 @@ public void setUp() throws IOException { * */ //@Test public void response_true_when_data_sync() throws Exception { - - Response response = null; downloadMetadata(); @@ -159,6 +160,57 @@ public void response_true_when_data_sync() throws Exception { d2.trackedEntityModule().trackedEntityInstances().blockingUpload(); } + //@Test + public void add_and_post_tei_using_repositories() throws Exception { + + downloadMetadata(); + + String childProgramUid = "IpHINAT79UW"; + + + // Organisation unit module -> get one organisation unit + OrganisationUnit organisationUnit = d2.organisationUnitModule().organisationUnits().one().blockingGet(); + + // Program module -> get the program by its uid + Program program = d2.programModule().programs() + .uid(childProgramUid) + .blockingGet(); + + // Tracked entity module -> add a new tracked entity instance + String teiUid = d2.trackedEntityModule().trackedEntityInstances() + .blockingAdd(TrackedEntityInstanceCreateProjection.builder() + .organisationUnit(organisationUnit.uid()) + .trackedEntityType(program.trackedEntityType().uid()) + .build()); + + // Enrollment module -> enroll the tracked entity instance to the program + d2.enrollmentModule().enrollments().add( + EnrollmentCreateProjection.builder() + .organisationUnit(organisationUnit.uid()) + .program(program.uid()) + .trackedEntityInstance(teiUid) + .build() + ); + + // Program module -> get the program tracked entity attributes of the program + /*List attributes = d2.programModule() + .programTrackedEntityAttributes() + .byProgram().eq(program.uid()) + .blockingGet(); + + // Iterate the program tracked entity attributes + for (ProgramTrackedEntityAttribute at : attributes) { + if (at.mandatory()) { + // For each one, if mandatory: Tracked entity module -> set a tracked entity attribute value. + d2.trackedEntityModule().trackedEntityAttributeValues() + .value(at.trackedEntityAttribute().uid(), teiUid) + .blockingSet(at.name() + " - value"); + } + }*/ + + d2.trackedEntityModule().trackedEntityInstances().blockingUpload(); + } + /* * If you want run this test you need config the correct uids in the server side. @@ -446,7 +498,7 @@ public void post_a_tei_and_delete_one_event() throws Exception { } } - assertThat(deleted).isEqualTo(true); + assertThat(deleted).isTrue(); } private void insertATei(String uid, TrackedEntityInstance tei, Geometry geometry) { diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityInstancePostCallMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityInstancePostPayloadGeneratorMockIntegrationShould.java similarity index 87% rename from core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityInstancePostCallMockIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityInstancePostPayloadGeneratorMockIntegrationShould.java index 2bb219d4bd..0f9d6d8494 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityInstancePostCallMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityInstancePostPayloadGeneratorMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.trackedentity.internal; @@ -76,9 +76,10 @@ import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) -public class TrackedEntityInstancePostCallMockIntegrationShould extends BaseMockIntegrationTestMetadataEnqueable { +public class TrackedEntityInstancePostPayloadGeneratorMockIntegrationShould extends BaseMockIntegrationTestMetadataEnqueable { - private static TrackedEntityInstancePostCall trackedEntityInstancePostCall; + private static TrackedEntityInstancePostPayloadGenerator payloadGenerator; + private static TrackedEntityInstanceStore teiStore; private final String teiId = "teiId"; private final String enrollment1Id = "enrollment1Id"; @@ -96,15 +97,15 @@ public void tearDown() throws D2Error { @BeforeClass public static void setUpClass() throws Exception { BaseMockIntegrationTestMetadataEnqueable.setUpClass(); - trackedEntityInstancePostCall = objects.d2DIComponent.trackedEntityInstancePostCall(); + payloadGenerator = objects.d2DIComponent.trackedEntityInstancePostPayloadGenerator(); + teiStore = TrackedEntityInstanceStoreImpl.create(d2.databaseAdapter()); } @Test public void build_payload_with_different_enrollments() { storeTrackedEntityInstance(); - List> partitions = - trackedEntityInstancePostCall.getPartitionsToSync(null); + List> partitions = getPartitions(); assertThat(partitions.size()).isEqualTo(1); assertThat(partitions.get(0).size()).isEqualTo(1); @@ -119,12 +120,15 @@ public void build_payload_with_different_enrollments() { } } + private List> getPartitions() { + return payloadGenerator.getTrackedEntityInstancesPartitions(teiStore.queryTrackedEntityInstancesToSync()); + } + @Test public void build_payload_with_the_enrollments_events_and_values_set_for_upload() { storeTrackedEntityInstance(); - List> partitions = - trackedEntityInstancePostCall.getPartitionsToSync(null); + List> partitions = getPartitions(); assertThat(partitions.size()).isEqualTo(1); assertThat(partitions.get(0).size()).isEqualTo(1); @@ -144,8 +148,7 @@ public void build_payload_without_events_marked_as_error() { storeTrackedEntityInstance(); EnrollmentStoreImpl.create(databaseAdapter).setState("enrollment3Id", State.TO_POST); - List> partitions = - trackedEntityInstancePostCall.getPartitionsToSync(null); + List> partitions = getPartitions(); assertThat(partitions.size()).isEqualTo(1); assertThat(partitions.get(0).size()).isEqualTo(1); @@ -227,13 +230,13 @@ public void recreate_teis_with_filters_and_relationships() throws Exception { storeRelationship("relationship3", tei1, tei5); storeRelationship("relationship4", tei5, tei4); - List> partitions = trackedEntityInstancePostCall.getPartitionsToSync( + List> partitions = payloadGenerator.getTrackedEntityInstancesPartitions( d2.trackedEntityModule().trackedEntityInstances().byUid().eq(tei1) .byState().in(State.uploadableStates()).blockingGet()); assertThat(partitions.size()).isEqualTo(1); assertThat(partitions.get(0).size()).isEqualTo(3); - assertThat(UidsHelper.getUidsList(partitions.get(0)).containsAll(Lists.newArrayList(tei1, tei2, tei3))).isEqualTo(true); + assertThat(UidsHelper.getUidsList(partitions.get(0)).containsAll(Lists.newArrayList(tei1, tei2, tei3))).isTrue(); } @Test @@ -241,7 +244,7 @@ public void mark_payload_as_uploading() { storeTrackedEntityInstance(); // Ignore result. Just interested in check that target TEIs are marked as UPLOADING - List> partitions = trackedEntityInstancePostCall.getPartitionsToSync(null); + List> partitions = getPartitions(); TrackedEntityInstance instance = TrackedEntityInstanceStoreImpl.create(databaseAdapter).selectFirst(); assertThat(instance.state()).isEqualTo(State.UPLOADING); @@ -304,8 +307,7 @@ public void build_payload_with_enrollment_notes() throws D2Error { .value("This is an enrollment note") .build()); - List> partitions = - trackedEntityInstancePostCall.getPartitionsToSync(null); + List> partitions = getPartitions(); assertThat(partitions.size()).isEqualTo(1); assertThat(partitions.get(0).size()).isEqualTo(1); @@ -330,8 +332,7 @@ public void build_payload_with_event_notes() throws D2Error { .value("This is an event note") .build()); - List> partitions = - trackedEntityInstancePostCall.getPartitionsToSync(null); + List> partitions = getPartitions(); assertThat(partitions.size()).isEqualTo(1); assertThat(partitions.get(0).size()).isEqualTo(1); diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityInstanceStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityInstanceStoreIntegrationShould.java index 1be569d35c..9021ead822 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityInstanceStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityInstanceStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.trackedentity.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityInstanceSyncStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityInstanceSyncStoreIntegrationShould.java index e479b21761..8063b3a940 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityInstanceSyncStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityInstanceSyncStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.trackedentity.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityTypeAttributeStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityTypeAttributeStoreIntegrationShould.java index faa1466352..01251718fc 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityTypeAttributeStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityTypeAttributeStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.trackedentity.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityTypeStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityTypeStoreIntegrationShould.java index 88ae927e44..cc432910f6 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityTypeStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/internal/TrackedEntityTypeStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.trackedentity.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/search/TrackedEntityInstanceQueryAndDownloadRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/search/TrackedEntityInstanceQueryAndDownloadRealIntegrationShould.java deleted file mode 100644 index 82bc2f0775..0000000000 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/search/TrackedEntityInstanceQueryAndDownloadRealIntegrationShould.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2004-2019, 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.trackedentity.search; - -import org.hisp.dhis.android.core.BaseRealIntegrationTest; -import org.hisp.dhis.android.core.D2; -import org.hisp.dhis.android.core.D2Factory; -import org.hisp.dhis.android.core.organisationunit.OrganisationUnitMode; -import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstance; -import org.junit.Before; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import static com.google.common.truth.Truth.assertThat; - -public class TrackedEntityInstanceQueryAndDownloadRealIntegrationShould extends BaseRealIntegrationTest { - private D2 d2; - private TrackedEntityInstanceQueryCollectionRepository repository; - - @Before - @Override - public void setUp() throws IOException { - super.setUp(); - - d2 = D2Factory.forNewDatabase(); - - - List orgUnits = new ArrayList<>(); - orgUnits.add("O6uvpzGd5pu"); - - repository = d2.trackedEntityModule().trackedEntityInstanceQuery() - .byOrgUnits().in(orgUnits).byOrgUnitMode().eq(OrganisationUnitMode.ACCESSIBLE); - } - - //@Test - public void query_and_download_tracked_entity_instances() { - login(); - - d2.metadataModule().blockingDownload(); - - List queriedTeis = repository.onlineOnly().blockingGet(); - assertThat(queriedTeis).isNotEmpty(); - - Set uids = new HashSet<>(queriedTeis.size()); - - for(TrackedEntityInstance tei: queriedTeis) { - uids.add(tei.uid()); - } - - d2.trackedEntityModule().trackedEntityInstanceDownloader().byUid().in(uids).blockingDownload(); - List downloadedTeis = d2.trackedEntityModule().trackedEntityInstances().byUid().in(uids).blockingGet(); - - assertThat(queriedTeis.size()).isEqualTo(downloadedTeis.size()); - } - - private void login() { - d2.userModule().logIn(username, password, url).blockingGet(); - } -} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/search/TrackedEntityInstanceQueryAndDownloadRealIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/search/TrackedEntityInstanceQueryAndDownloadRealIntegrationShould.kt new file mode 100644 index 0000000000..c0cf723949 --- /dev/null +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/search/TrackedEntityInstanceQueryAndDownloadRealIntegrationShould.kt @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2004-2021, 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.trackedentity.search + +import com.google.common.truth.Truth.assertThat +import java.io.IOException +import org.hisp.dhis.android.core.BaseRealIntegrationTest +import org.hisp.dhis.android.core.D2 +import org.hisp.dhis.android.core.D2Factory +import org.hisp.dhis.android.core.organisationunit.OrganisationUnitMode +import org.junit.Before + +class TrackedEntityInstanceQueryAndDownloadRealIntegrationShould : BaseRealIntegrationTest() { + private lateinit var d2: D2 + + @Before + @Throws(IOException::class) + override fun setUp() { + super.setUp() + d2 = D2Factory.forNewDatabase() + } + + // @Test + fun query_and_download_tracked_entity_instances() { + d2.userModule().logIn(username, password, url).blockingGet() + d2.metadataModule().blockingDownload() + + val orgUnit = d2.organisationUnitModule().organisationUnits() + .one().blockingGet().uid() + val queriedTeis = d2.trackedEntityModule().trackedEntityInstanceQuery() + .byOrgUnits().`in`(listOf(orgUnit)) + .byOrgUnitMode().eq(OrganisationUnitMode.ACCESSIBLE) + .onlineOnly().blockingGet() + assertThat(queriedTeis).isNotEmpty() + + val uids = queriedTeis.map { it.uid() }.toSet() + + d2.trackedEntityModule().trackedEntityInstanceDownloader() + .byUid().`in`(uids).blockingDownload() + val downloadedTeis = d2.trackedEntityModule().trackedEntityInstances() + .byUid().`in`(uids).blockingGet() + assertThat(queriedTeis.size).isEqualTo(downloadedTeis.size) + } +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/search/TrackedEntityInstanceQueryCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/search/TrackedEntityInstanceQueryCallRealIntegrationShould.java index dfd6f4d283..ba976149a8 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/search/TrackedEntityInstanceQueryCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/search/TrackedEntityInstanceQueryCallRealIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.trackedentity.search; @@ -43,7 +43,7 @@ import java.util.List; import static com.google.common.truth.Truth.assertThat; -import static junit.framework.Assert.fail; +import static org.junit.Assert.fail; public class TrackedEntityInstanceQueryCallRealIntegrationShould extends BaseRealIntegrationTest { private D2 d2; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/search/TrackedEntityInstanceQueryCollectionRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/search/TrackedEntityInstanceQueryCollectionRepositoryMockIntegrationShould.java index fcb3f2a8c8..92d78a34ff 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/search/TrackedEntityInstanceQueryCollectionRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/trackedentity/search/TrackedEntityInstanceQueryCollectionRepositoryMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.trackedentity.search; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/user/LoginErrorHandlingRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/user/LoginErrorHandlingRealIntegrationShould.java index a773687fe2..4916c7fe86 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/user/LoginErrorHandlingRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/user/LoginErrorHandlingRealIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.user; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/user/OpenIdConnectRealIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/user/OpenIdConnectRealIntegrationShould.kt new file mode 100644 index 0000000000..d15d67880d --- /dev/null +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/user/OpenIdConnectRealIntegrationShould.kt @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2004-2021, 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.user + +import java.io.IOException +import net.openid.appauth.AuthState +import org.hisp.dhis.android.core.BaseRealIntegrationTest +import org.hisp.dhis.android.core.D2 +import org.hisp.dhis.android.core.D2Factory +import org.junit.Before + +class OpenIdConnectRealIntegrationShould : BaseRealIntegrationTest() { + + private lateinit var d2: D2 + + @Before + @Throws(IOException::class) + override fun setUp() { + super.setUp() + d2 = D2Factory.forNewDatabase() + } + + // @Test(expected = D2Error::class) + fun throw_error_when_not_passing_token() { + val logInCall = getD2DIComponent(d2).internalModules().user.logInCall + logInCall.blockingLogInOpenIDConnect(url, AuthState()) + } +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/user/UserModuleMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/user/UserModuleMockIntegrationShould.java index 94aa851f13..1cf6be7033 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/user/UserModuleMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/user/UserModuleMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.user; @@ -35,8 +35,7 @@ import java.util.List; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) public class UserModuleMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { @@ -44,30 +43,30 @@ public class UserModuleMockIntegrationShould extends BaseMockIntegrationTestFull @Test public void allow_access_to_authenticated_user() { AuthenticatedUser authenticatedUser = d2.userModule().authenticatedUser().blockingGet(); - assertThat(authenticatedUser.user(), is("DXyJmlo9rge")); + assertThat(authenticatedUser.user()).isEqualTo("DXyJmlo9rge"); } @Test public void allow_access_to_user_credentials() { UserCredentials credentials = d2.userModule().userCredentials().blockingGet(); - assertThat(credentials.username(), is("android")); - assertThat(credentials.code(), is("android")); - assertThat(credentials.name(), is("John Barnes")); + assertThat(credentials.username()).isEqualTo("android"); + assertThat(credentials.code()).isEqualTo("android"); + assertThat(credentials.name()).isEqualTo("John Barnes"); } @Test public void allow_access_to_user_role() { List userRole = d2.userModule().userRoles().blockingGet(); - assertThat(userRole.get(0).uid(), is("Ufph3mGRmMo")); - assertThat(userRole.get(0).name(), is("Superuser")); - assertThat(userRole.get(0).displayName(), is("Superuser")); + assertThat(userRole.get(0).uid()).isEqualTo("Ufph3mGRmMo"); + assertThat(userRole.get(0).name()).isEqualTo("Superuser"); + assertThat(userRole.get(0).displayName()).isEqualTo("Superuser"); } @Test public void allow_access_to_user() { User user = d2.userModule().user().blockingGet(); - assertThat(user.uid(), is("DXyJmlo9rge")); - assertThat(user.firstName(), is("John")); - assertThat(user.email(), is("john@hmail.com")); + assertThat(user.uid()).isEqualTo("DXyJmlo9rge"); + assertThat(user.firstName()).isEqualTo("John"); + assertThat(user.email()).isEqualTo("john@hmail.com"); } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/AuthenticatedUserStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/AuthenticatedUserStoreIntegrationShould.java index 1574731a81..6aef73d816 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/AuthenticatedUserStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/AuthenticatedUserStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.user.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/AuthorityStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/AuthorityStoreIntegrationShould.java index 91ff9614e0..87ad6e9f1f 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/AuthorityStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/AuthorityStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.user.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/UserAuthenticateCallMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/LogInCallMockIntegrationShould.java similarity index 62% rename from core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/UserAuthenticateCallMockIntegrationShould.java rename to core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/LogInCallMockIntegrationShould.java index 83c65951d6..03318b1df3 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/UserAuthenticateCallMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/LogInCallMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.user.internal; @@ -46,7 +46,7 @@ // ToDo: more tests to verify correct store behaviour // ToDo: - what will happen if the same user will be inserted twice? @RunWith(D2JunitRunner.class) -public class UserAuthenticateCallMockIntegrationShould extends BaseMockIntegrationTestEmptyEnqueable { +public class LogInCallMockIntegrationShould extends BaseMockIntegrationTestEmptyEnqueable { @Before public void setUp() throws D2Error { diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/LogoutCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/LogoutCallRealIntegrationShould.java index 34c53eb13a..2d2a7d3148 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/LogoutCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/LogoutCallRealIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.user.internal; @@ -39,6 +39,7 @@ import org.junit.Before; import java.io.IOException; +import java.util.Collections; import java.util.List; import java.util.concurrent.Callable; @@ -67,7 +68,7 @@ public void delete_credentials_when_log_out_after_sync_data() throws Exception { d2.metadataModule().blockingDownload(); - Callable> eventCall = EventCallFactory.create(d2.retrofit(), d2.databaseAdapter(), "DiszpKrYNg8", 0); + Callable> eventCall = EventCallFactory.create(d2.retrofit(), d2.databaseAdapter(), "DiszpKrYNg8", 0, Collections.emptyList()); eventCall.call(); diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/UserAuthenticateWithEncryptionMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/UserAuthenticateWithEncryptionMockIntegrationShould.java index ba16f0938e..59c0c09a0a 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/UserAuthenticateWithEncryptionMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/UserAuthenticateWithEncryptionMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.user.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/UserCallMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/UserCallMockIntegrationShould.java deleted file mode 100644 index 1cb57cffe0..0000000000 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/UserCallMockIntegrationShould.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2004-2019, 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.user.internal; - -import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore; -import org.hisp.dhis.android.core.data.user.UserCredentialsSamples; -import org.hisp.dhis.android.core.data.user.UserSamples; -import org.hisp.dhis.android.core.user.User; -import org.hisp.dhis.android.core.user.UserCredentials; -import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestEmptyEnqueable; -import org.hisp.dhis.android.core.utils.runner.D2JunitRunner; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; - -import java.util.concurrent.Callable; - -import static com.google.common.truth.Truth.assertThat; - -@RunWith(D2JunitRunner.class) -public class UserCallMockIntegrationShould extends BaseMockIntegrationTestEmptyEnqueable { - - private static IdentifiableObjectStore userStore; - private static IdentifiableObjectStore userCredentialsStore; - - @BeforeClass - public static void setUpClass() throws Exception { - BaseMockIntegrationTestEmptyEnqueable.setUpClass(); - - Callable userCall = objects.d2DIComponent.internalModules().user.userCall; - userStore = UserStore.create(databaseAdapter); - userCredentialsStore = UserCredentialsStoreImpl.create(databaseAdapter); - - dhis2MockServer.enqueueMockResponse("user/user.json"); - userCall.call(); - } - - @Test - public void persist_user_in_database_when_call() { - assertThat(userStore.count()).isEqualTo(1); - assertThat(userStore.selectFirst()).isEqualTo(UserSamples.getUser()); - } - - @Test - public void persist_user_credentials_in_database_when_call() { - assertThat(userCredentialsStore.count()).isEqualTo(1); - assertThat(userCredentialsStore.selectFirst()).isEqualTo(UserCredentialsSamples.getUserCredentials()); - } -} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/UserCallMockIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/UserCallMockIntegrationShould.kt new file mode 100644 index 0000000000..c6aefd0a3a --- /dev/null +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/UserCallMockIntegrationShould.kt @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2004-2021, 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.user.internal + +import com.google.common.truth.Truth +import java.util.concurrent.Callable +import org.hisp.dhis.android.core.arch.db.stores.internal.IdentifiableObjectStore +import org.hisp.dhis.android.core.data.user.UserCredentialsSamples +import org.hisp.dhis.android.core.data.user.UserSamples +import org.hisp.dhis.android.core.user.User +import org.hisp.dhis.android.core.user.UserCredentials +import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestEmptyEnqueable +import org.hisp.dhis.android.core.utils.runner.D2JunitRunner +import org.junit.BeforeClass +import org.junit.Test +import org.junit.runner.RunWith + +@RunWith(D2JunitRunner::class) +class UserCallMockIntegrationShould : BaseMockIntegrationTestEmptyEnqueable() { + + companion object { + private lateinit var userStore: IdentifiableObjectStore + private lateinit var userCredentialsStore: IdentifiableObjectStore + + @BeforeClass + @JvmStatic + @Throws(Exception::class) + internal fun setUpClass() { + BaseMockIntegrationTestEmptyEnqueable.setUpClass() + val userCall: Callable = objects.d2DIComponent.internalModules().user.userCall + userStore = UserStore.create(databaseAdapter) + userCredentialsStore = UserCredentialsStoreImpl.create(databaseAdapter) + dhis2MockServer.enqueueMockResponse("user/user.json") + userCall.call() + } + } + + @Test + fun persist_user_in_database_when_call() { + Truth.assertThat(userStore.count()).isEqualTo(1) + Truth.assertThat(userStore.selectFirst()).isEqualTo(UserSamples.getUser()) + } + + @Test + fun persist_user_credentials_in_database_when_call() { + Truth.assertThat(userCredentialsStore.count()).isEqualTo(1) + Truth.assertThat(userCredentialsStore.selectFirst()).isEqualTo(UserCredentialsSamples.getUserCredentials()) + } +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/UserOrganisationUnitLinkStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/UserOrganisationUnitLinkStoreIntegrationShould.java index 15e7bb522c..bfd7296ce7 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/UserOrganisationUnitLinkStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/UserOrganisationUnitLinkStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.user.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/UserRoleStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/UserRoleStoreIntegrationShould.java index aafa7f0058..762e849e47 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/UserRoleStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/UserRoleStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.user.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/utils/DatabaseRemover.java b/core/src/androidTest/java/org/hisp/dhis/android/core/utils/DatabaseRemover.java index 8d55f82fc8..9a3d76905a 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/utils/DatabaseRemover.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/utils/DatabaseRemover.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.utils; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/BaseMockIntegrationTest.java b/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/BaseMockIntegrationTest.java index ef1a87c557..c20ac433c2 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/BaseMockIntegrationTest.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/BaseMockIntegrationTest.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.utils.integration.mock; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/BaseMockIntegrationTestEmptyDispatcher.java b/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/BaseMockIntegrationTestEmptyDispatcher.java index 7ba7237802..c56d5780b3 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/BaseMockIntegrationTestEmptyDispatcher.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/BaseMockIntegrationTestEmptyDispatcher.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.utils.integration.mock; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/BaseMockIntegrationTestEmptyEnqueable.java b/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/BaseMockIntegrationTestEmptyEnqueable.java index eb6bae7b2d..e97d3194c4 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/BaseMockIntegrationTestEmptyEnqueable.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/BaseMockIntegrationTestEmptyEnqueable.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.utils.integration.mock; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/BaseMockIntegrationTestFullDispatcher.java b/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/BaseMockIntegrationTestFullDispatcher.java index bd189d32e9..380a4b8c1e 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/BaseMockIntegrationTestFullDispatcher.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/BaseMockIntegrationTestFullDispatcher.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.utils.integration.mock; @@ -92,7 +92,7 @@ private static void downloadEvents() { } private static void downloadAggregatedData() { - d2.aggregatedModule().data().download().subscribe(); + d2.aggregatedModule().data().blockingDownload(); } private static void storeSomeD2Errors() { diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/BaseMockIntegrationTestLocalAnalyticsSuperLargeDispatcher.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/BaseMockIntegrationTestLocalAnalyticsSuperLargeDispatcher.kt index 72cbfa5263..c54bfb8159 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/BaseMockIntegrationTestLocalAnalyticsSuperLargeDispatcher.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/BaseMockIntegrationTestLocalAnalyticsSuperLargeDispatcher.kt @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.utils.integration.mock @@ -46,12 +46,14 @@ abstract class BaseMockIntegrationTestLocalAnalyticsSuperLargeDispatcher : BaseM val isNewInstance = setUpClass(MockIntegrationTestDatabaseContent.LocalAnalyticsSuperLargeDispatcher) if (isNewInstance) { objects.dhis2MockServer.setRequestDispatcher() - objects.d2.userModule().blockingLogIn(RealServerMother.username, RealServerMother.password, - objects.dhis2MockServer.baseEndpoint) + objects.d2.userModule().blockingLogIn( + RealServerMother.username, RealServerMother.password, + objects.dhis2MockServer.baseEndpoint + ) } val filler = LocalAnalyticsDatabaseFiller(objects.d2) filler.fillDatabase(LocalAnalyticsMetadataParams.Default, LocalAnalyticsDataParams.get(SizeFactor)) } } -} \ No newline at end of file +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/BaseMockIntegrationTestMetadataDispatcher.java b/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/BaseMockIntegrationTestMetadataDispatcher.java index fc8239e32a..6dfa8bbadc 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/BaseMockIntegrationTestMetadataDispatcher.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/BaseMockIntegrationTestMetadataDispatcher.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.utils.integration.mock; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/BaseMockIntegrationTestMetadataEnqueable.java b/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/BaseMockIntegrationTestMetadataEnqueable.java index e404d58bce..8f82dce397 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/BaseMockIntegrationTestMetadataEnqueable.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/BaseMockIntegrationTestMetadataEnqueable.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.utils.integration.mock; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/MockIntegrationTestDatabaseContent.java b/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/MockIntegrationTestDatabaseContent.java index 454fbc659a..7846a176b1 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/MockIntegrationTestDatabaseContent.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/MockIntegrationTestDatabaseContent.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.utils.integration.mock; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/MockIntegrationTestObjectsFactory.java b/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/MockIntegrationTestObjectsFactory.java index ee5801b59a..2f05aa9677 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/MockIntegrationTestObjectsFactory.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/MockIntegrationTestObjectsFactory.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.utils.integration.mock; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/TestDatabaseAdapterFactory.java b/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/TestDatabaseAdapterFactory.java index 0f540a168b..e0197b32af 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/TestDatabaseAdapterFactory.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/utils/integration/mock/TestDatabaseAdapterFactory.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.utils.integration.mock; @@ -32,8 +32,6 @@ import androidx.test.platform.app.InstrumentationRegistry; -import com.facebook.stetho.Stetho; - import org.hisp.dhis.android.core.arch.db.access.DatabaseAdapter; import org.hisp.dhis.android.core.arch.db.access.internal.DatabaseAdapterFactory; import org.hisp.dhis.android.core.arch.storage.internal.InMemorySecureStore; @@ -58,7 +56,6 @@ public static void tearDown() { private static DatabaseAdapter create() { Context context = InstrumentationRegistry.getInstrumentation().getContext(); - Stetho.initializeWithDefaults(context); DatabaseAdapterFactory databaseAdapterFactory = DatabaseAdapterFactory.create(context, new InMemorySecureStore()); DatabaseAdapter parentDatabaseAdapter = databaseAdapterFactory.newParentDatabaseAdapter(); diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/utils/runner/D2JunitRunner.java b/core/src/androidTest/java/org/hisp/dhis/android/core/utils/runner/D2JunitRunner.java index 2c9fc64a44..42857374b5 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/utils/runner/D2JunitRunner.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/utils/runner/D2JunitRunner.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.utils.runner; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/utils/runner/D2JunitTestListener.java b/core/src/androidTest/java/org/hisp/dhis/android/core/utils/runner/D2JunitTestListener.java index c44884eb47..2b79da44a0 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/utils/runner/D2JunitTestListener.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/utils/runner/D2JunitTestListener.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.utils.runner; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/validation/internal/ValidationRuleStoreIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/validation/internal/ValidationRuleStoreIntegrationShould.java index 7feb76a2f4..4ae6c54766 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/validation/internal/ValidationRuleStoreIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/validation/internal/ValidationRuleStoreIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.validation.internal; diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/wipe/WipeDBCallMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/wipe/WipeDBCallMockIntegrationShould.java index 345636b73f..c4cb387808 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/wipe/WipeDBCallMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/wipe/WipeDBCallMockIntegrationShould.java @@ -1,34 +1,43 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.wipe; +import org.hisp.dhis.android.core.common.StorableObjectWithUid; import org.hisp.dhis.android.core.data.database.DatabaseAssert; +import org.hisp.dhis.android.core.fileresource.FileResource; +import org.hisp.dhis.android.core.fileresource.internal.FileResourceStoreImpl; +import org.hisp.dhis.android.core.imports.TrackerImportConflict; +import org.hisp.dhis.android.core.imports.internal.TrackerImportConflictStore; +import org.hisp.dhis.android.core.maintenance.D2Error; +import org.hisp.dhis.android.core.maintenance.D2ErrorCode; +import org.hisp.dhis.android.core.maintenance.internal.D2ErrorStore; +import org.hisp.dhis.android.core.tracker.importer.internal.TrackerJobStore; import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestEmptyDispatcher; import org.junit.Test; @@ -39,10 +48,10 @@ public void have_empty_database_when_wipe_db_after_sync_data() throws Exception givenAFreshLoginInDatabase(); givenAMetadataInDatabase(); + givenDataInDatabase(); + givenOthersInDatabase(); - givenAEventInDatabase(); - - DatabaseAssert.assertThatDatabase(databaseAdapter).isNotEmpty(); + DatabaseAssert.assertThatDatabase(databaseAdapter).isFull(); d2.wipeModule().wipeEverything(); @@ -61,9 +70,24 @@ private void givenAFreshLoginInDatabase() { private void givenAMetadataInDatabase() { d2.metadataModule().blockingDownload(); + d2.trackedEntityModule().reservedValueManager().blockingDownloadAllReservedValues(1); } - private void givenAEventInDatabase() { + private void givenDataInDatabase() { d2.eventModule().eventDownloader().limit(1).blockingDownload(); + d2.trackedEntityModule().trackedEntityInstanceDownloader().limit(1).blockingDownload(); + d2.aggregatedModule().data().blockingDownload(); + } + + private void givenOthersInDatabase() { + D2ErrorStore.create(databaseAdapter).insert(D2Error.builder() + .errorCode(D2ErrorCode.API_RESPONSE_PROCESS_ERROR) + .errorDescription("Sample error") + .build()); + + TrackerImportConflictStore.create(databaseAdapter).insert(TrackerImportConflict.builder().build()); + + FileResourceStoreImpl.create(databaseAdapter).insert(FileResource.builder().uid("uid").build()); + TrackerJobStore.create(databaseAdapter).insert(StorableObjectWithUid.create("uid")); } } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/wipe/WipeDBCallRealIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/core/wipe/WipeDBCallRealIntegrationShould.java index 340e6287c9..c2ef315866 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/wipe/WipeDBCallRealIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/wipe/WipeDBCallRealIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.wipe; @@ -39,6 +39,7 @@ import org.junit.Before; import java.io.IOException; +import java.util.Collections; import java.util.List; import java.util.concurrent.Callable; @@ -74,7 +75,7 @@ public void have_empty_database_when_wipe_db_after_sync_data() throws Exception d2.metadataModule().blockingDownload(); - Callable> eventCall = EventCallFactory.create(d2.retrofit(), d2.databaseAdapter(), "DiszpKrYNg8", 0); + Callable> eventCall = EventCallFactory.create(d2.retrofit(), d2.databaseAdapter(), "DiszpKrYNg8", 0, Collections.emptyList()); eventCall.call(); diff --git a/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/dbgeneration/LocalAnalyticsDataGenerator.kt b/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/dbgeneration/LocalAnalyticsDataGenerator.kt index ad0bb573b4..ad48678312 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/dbgeneration/LocalAnalyticsDataGenerator.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/dbgeneration/LocalAnalyticsDataGenerator.kt @@ -1,32 +1,34 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.localanalytics.dbgeneration +import java.util.* +import kotlin.random.Random import org.hisp.dhis.android.core.arch.helpers.UidGeneratorImpl import org.hisp.dhis.android.core.data.datavalue.DataValueSamples import org.hisp.dhis.android.core.data.enrollment.EnrollmentSamples @@ -44,8 +46,6 @@ import org.hisp.dhis.android.core.trackedentity.TrackedEntityAttribute import org.hisp.dhis.android.core.trackedentity.TrackedEntityAttributeValue import org.hisp.dhis.android.core.trackedentity.TrackedEntityDataValue import org.hisp.dhis.android.core.trackedentity.TrackedEntityInstance -import java.util.* -import kotlin.random.Random internal class LocalAnalyticsDataGenerator(private val params: LocalAnalyticsDataParams) { @@ -53,21 +53,30 @@ internal class LocalAnalyticsDataGenerator(private val params: LocalAnalyticsDat private val uidGenerator = UidGeneratorImpl() fun generateDataValues(metadata: MetadataForDataFilling): List { - val orgUnits: List = metadata.organisationUnits.filter { it.level() == 3 }.groupBy { it.parent() }.map { aa -> aa.value.first() } - val categoryOptionCombosByCategoryCombo = metadata.categoryOptionCombos.groupBy { coc -> coc.categoryCombo() } - val dataElementsByCategoryCombo = metadata.aggregatedDataElements.groupBy { de -> de.categoryCombo() } + val orgUnits: List = metadata.organisationUnits.filter { it.level() == 3 } + .groupBy { it.parent() }.map { aa -> aa.value.first() } + val categoryOptionCombosByCategoryCombo = metadata.categoryOptionCombos + .groupBy { coc -> coc.categoryCombo() } + val dataElementsByCategoryCombo = metadata.aggregatedDataElements + .groupBy { de -> de.categoryCombo() } - val periodOrgUnits = metadata.periods.flatMap { period -> orgUnits.map { ou -> Pair(period, ou) } } + val periodOrgUnits = metadata.periods.flatMap { + period -> + orgUnits.map { ou -> Pair(period, ou) } + } val iterations = params.dataValues / 100 - return categoryOptionCombosByCategoryCombo.flatMap { (categoryCombo, categoryOptionCombos) -> + return categoryOptionCombosByCategoryCombo.flatMap { + (categoryCombo, categoryOptionCombos) -> categoryOptionCombos.flatMap { categoryOptionCombo -> dataElementsByCategoryCombo[categoryCombo]!!.flatMap { dataElement -> (0 until iterations).map { val (period, ou) = periodOrgUnits[it] - DataValueSamples.getDataValue(ou.uid(), dataElement.uid(), period.periodId()!!, categoryOptionCombo.uid(), - metadata.categoryOptionCombos.first().uid(), random.nextDouble().toString()) + DataValueSamples.getDataValue( + ou.uid(), dataElement.uid(), period.periodId()!!, categoryOptionCombo.uid(), + metadata.categoryOptionCombos.first().uid(), random.nextDouble().toString() + ) } } } @@ -84,37 +93,49 @@ internal class LocalAnalyticsDataGenerator(private val params: LocalAnalyticsDat fun generateEnrollments(teis: List, program: Program): List { return teis.map { tei -> - EnrollmentSamples.get(uidGenerator.generate(), tei.organisationUnit(), program.uid(), tei.uid(), getRandomDateInLastYear()) + EnrollmentSamples.get( + uidGenerator.generate(), tei.organisationUnit(), program.uid(), tei.uid(), + getRandomDateInLastYear() + ) } } fun generateEventsWithoutRegistration(metadata: MetadataForDataFilling): List { val level3OrgUnits = metadata.organisationUnits.filter { ou -> ou.level() == 3 } val program = metadata.programs[1] - val programStages = metadata.programStages.filter { ps -> ps.program()!!.uid() == program.uid() } + val programStages = metadata.programStages + .filter { ps -> ps.program()!!.uid() == program.uid() } return (1..params.eventsWithoutRegistration).map { i -> val ou = level3OrgUnits[i % level3OrgUnits.size] val programStage = programStages[i % programStages.size] - EventSamples.get(uidGenerator.generate(), null, ou.uid(), programStage.program()!!.uid(), programStage.uid(), - metadata.categoryOptionCombos.first().uid(), getRandomDateInLastYear()) + EventSamples.get( + uidGenerator.generate(), null, ou.uid(), programStage.program()!!.uid(), programStage.uid(), + metadata.categoryOptionCombos.first().uid(), getRandomDateInLastYear() + ) } } fun generateEventsRegistration(metadata: MetadataForDataFilling, enrollments: List): List { val program = metadata.programs[0] - val programStages = metadata.programStages.filter { ps -> ps.program()!!.uid() == program.uid() } + val programStages = metadata.programStages + .filter { ps -> ps.program()!!.uid() == program.uid() } return enrollments.flatMap { enrollment -> programStages.flatMap { ps -> (1..params.eventsWithRegistrationPerEnrollmentAndPS).map { - EventSamples.get(uidGenerator.generate(), enrollment.uid(), enrollment.organisationUnit(), - enrollment.program(), ps.uid(), metadata.categoryOptionCombos.first().uid(), - getRandomDateInLastYear()) + EventSamples.get( + uidGenerator.generate(), enrollment.uid(), enrollment.organisationUnit(), + enrollment.program(), ps.uid(), metadata.categoryOptionCombos.first().uid(), + getRandomDateInLastYear() + ) } } } } - fun generateTrackedEntityAttributeValues(trackedEntityAttributes: List, teis: List): List { + fun generateTrackedEntityAttributeValues( + trackedEntityAttributes: List, + teis: List + ): List { return trackedEntityAttributes.flatMap { tea -> teis.map { tei -> TrackedEntityAttributeValueSamples.get(tea.uid(), tei.uid(), generateRandomStringValue()) @@ -122,7 +143,10 @@ internal class LocalAnalyticsDataGenerator(private val params: LocalAnalyticsDat } } - fun generateTrackedEntityDataValues(dataElements: List, events: List): List { + fun generateTrackedEntityDataValues( + dataElements: List, + events: List + ): List { return dataElements.flatMap { de -> events.map { event -> TrackedEntityDataValueSamples.get(de.uid(), event.uid(), generateRandomStringValue()) @@ -140,4 +164,4 @@ internal class LocalAnalyticsDataGenerator(private val params: LocalAnalyticsDat val millis = now - random.nextDouble() * oneYearMillis return Date(millis.toLong()) } -} \ No newline at end of file +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/dbgeneration/LocalAnalyticsDatabaseFiller.kt b/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/dbgeneration/LocalAnalyticsDatabaseFiller.kt index 66795a6b61..c15c4e1ed1 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/dbgeneration/LocalAnalyticsDatabaseFiller.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/dbgeneration/LocalAnalyticsDatabaseFiller.kt @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.localanalytics.dbgeneration @@ -52,14 +52,16 @@ import org.hisp.dhis.android.core.trackedentity.internal.TrackedEntityAttributeV import org.hisp.dhis.android.core.trackedentity.internal.TrackedEntityDataValueStoreImpl import org.hisp.dhis.android.core.trackedentity.internal.TrackedEntityInstanceStoreImpl -internal data class MetadataForDataFilling(val organisationUnits: List, - val periods: List, - val categoryOptionCombos: List, - val aggregatedDataElements: List, - val trackerDataElements: List, - val programs: List, - val programStages: List, - val trackedEntityAttributes: List) +internal data class MetadataForDataFilling( + val organisationUnits: List, + val periods: List, + val categoryOptionCombos: List, + val aggregatedDataElements: List, + val trackerDataElements: List, + val programs: List, + val programStages: List, + val trackedEntityAttributes: List +) internal class LocalAnalyticsDatabaseFiller(private val d2: D2) { private val da = d2.databaseAdapter() @@ -102,8 +104,10 @@ internal class LocalAnalyticsDatabaseFiller(private val d2: D2) { val periods = d2.periodModule().periods().byPeriodType().eq(PeriodType.Daily).blockingGet() - return MetadataForDataFilling(organisationUnits, periods, categoryOptionCombos, aggregatedDataElements, - trackerDataElements, programs, programStages, trackedEntityAttributes) + return MetadataForDataFilling( + organisationUnits, periods, categoryOptionCombos, aggregatedDataElements, + trackerDataElements, programs, programStages, trackedEntityAttributes + ) } private fun fillData(dataParams: LocalAnalyticsDataParams, metadata: MetadataForDataFilling) { @@ -119,14 +123,15 @@ internal class LocalAnalyticsDatabaseFiller(private val d2: D2) { EnrollmentStoreImpl.create(da).insert(enrollments) val events = generator.generateEventsWithoutRegistration(metadata) + - generator.generateEventsRegistration(metadata, enrollments) + generator.generateEventsRegistration(metadata, enrollments) EventStoreImpl.create(da).insert(events) TrackedEntityAttributeValueStoreImpl.create(da).insert( - generator.generateTrackedEntityAttributeValues(metadata.trackedEntityAttributes, teis)) + generator.generateTrackedEntityAttributeValues(metadata.trackedEntityAttributes, teis) + ) TrackedEntityDataValueStoreImpl.create(da).insert( - generator.generateTrackedEntityDataValues(metadata.trackerDataElements, events) + generator.generateTrackedEntityDataValues(metadata.trackerDataElements, events) ) } -} \ No newline at end of file +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/dbgeneration/LocalAnalyticsMetadataGenerator.kt b/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/dbgeneration/LocalAnalyticsMetadataGenerator.kt index 8cf9309920..c907c7ef47 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/dbgeneration/LocalAnalyticsMetadataGenerator.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/dbgeneration/LocalAnalyticsMetadataGenerator.kt @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.localanalytics.dbgeneration @@ -55,8 +55,10 @@ internal class LocalAnalyticsMetadataGenerator(private val params: LocalAnalytic private fun getOrganisationUnitChildren(parent: OrganisationUnit): List { return (1..params.organisationUnitChildren).map { i -> - OrganisationUnitSamples.getOrganisationUnit("${parent.name()} $i", parent.level()!! + 1, - parent) + OrganisationUnitSamples.getOrganisationUnit( + "${parent.name()} $i", parent.level()!! + 1, + parent + ) } } @@ -83,20 +85,32 @@ internal class LocalAnalyticsMetadataGenerator(private val params: LocalAnalytic fun getDataElementsAggregated(categoryCombos: List): List { return categoryCombos.flatMap { categoryCombo -> (1..params.dataElementsAggregated).map { i -> - DataElementSamples.getDataElement("DE Aggr $i", null, ObjectWithUid.create(categoryCombo.uid()), "AGGREGATE") + DataElementSamples.getDataElement( + "DE Aggr $i", null, + ObjectWithUid.create(categoryCombo.uid()), "AGGREGATE" + ) } } } fun getDataElementsTracker(categoryCombo: CategoryCombo): List { return (1..params.dataElementsTracker).map { i -> - DataElementSamples.getDataElement("DE Tracker $i", null, ObjectWithUid.create(categoryCombo.uid()), "TRACKER") + DataElementSamples.getDataElement( + "DE Tracker $i", null, + ObjectWithUid.create(categoryCombo.uid()), "TRACKER" + ) } } fun getPrograms(categoryCombo: CategoryCombo): List { - val withReg = ProgramSamples.getProgram("Program with registration", ProgramType.WITH_REGISTRATION, categoryCombo) - val withoutReg = ProgramSamples.getProgram("Program without registration", ProgramType.WITHOUT_REGISTRATION, categoryCombo) + val withReg = ProgramSamples.getProgram( + "Program with registration", + ProgramType.WITH_REGISTRATION, categoryCombo + ) + val withoutReg = ProgramSamples.getProgram( + "Program without registration", + ProgramType.WITHOUT_REGISTRATION, categoryCombo + ) return listOf(withReg, withoutReg) } @@ -117,4 +131,4 @@ internal class LocalAnalyticsMetadataGenerator(private val params: LocalAnalytic TrackedEntityAttributeSamples.get("TEA $i") } } -} \ No newline at end of file +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/dbgeneration/LocalAnalyticsParams.kt b/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/dbgeneration/LocalAnalyticsParams.kt index 5a708f1fec..a6303e5d10 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/dbgeneration/LocalAnalyticsParams.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/dbgeneration/LocalAnalyticsParams.kt @@ -1,68 +1,73 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.localanalytics.dbgeneration -internal data class LocalAnalyticsMetadataParams(val organisationUnitChildren: Int, - val categoryOptionCombos2: Int, - val categoryOptionCombos3: Int, - val dataElementsAggregated: Int, - val dataElementsTracker: Int, - val programStagesWithRegistration: Int, - val programStagesWithoutRegistration: Int, - val trackedEntityAttributes: Int) { +internal data class LocalAnalyticsMetadataParams( + val organisationUnitChildren: Int, + val categoryOptionCombos2: Int, + val categoryOptionCombos3: Int, + val dataElementsAggregated: Int, + val dataElementsTracker: Int, + val programStagesWithRegistration: Int, + val programStagesWithoutRegistration: Int, + val trackedEntityAttributes: Int +) { companion object LocalAnalyticsMetadataParams { val Default = LocalAnalyticsMetadataParams( - organisationUnitChildren = 3, - categoryOptionCombos2 = 3, - categoryOptionCombos3 = 6, - dataElementsAggregated = 10, - dataElementsTracker = 10, - programStagesWithRegistration = 3, - programStagesWithoutRegistration = 1, - trackedEntityAttributes = 10) + organisationUnitChildren = 3, + categoryOptionCombos2 = 3, + categoryOptionCombos3 = 6, + dataElementsAggregated = 10, + dataElementsTracker = 10, + programStagesWithRegistration = 3, + programStagesWithoutRegistration = 1, + trackedEntityAttributes = 10 + ) } } -internal data class LocalAnalyticsDataParams(val dataValues: Int, - val trackedEntityInstances: Int, - val eventsWithoutRegistration: Int, - val eventsWithRegistrationPerEnrollmentAndPS: Int) { +internal data class LocalAnalyticsDataParams( + val dataValues: Int, + val trackedEntityInstances: Int, + val eventsWithoutRegistration: Int, + val eventsWithRegistrationPerEnrollmentAndPS: Int +) { companion object LocalAnalyticsDataParams { fun get(f: Int) = LocalAnalyticsDataParams( - dataValues = 3000 * f, - trackedEntityInstances = 500 * f, - eventsWithoutRegistration = 500 * f, - eventsWithRegistrationPerEnrollmentAndPS = 1 + dataValues = 3000 * f, + trackedEntityInstances = 500 * f, + eventsWithoutRegistration = 500 * f, + eventsWithRegistrationPerEnrollmentAndPS = 1 ) const val DefaultFactor = 1 const val LargeFactor = 3 const val SuperLargeFactor = 6 } -} \ No newline at end of file +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/dbtests/BaseLocalAnalyticsDatabaseSizeMockIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/dbtests/BaseLocalAnalyticsDatabaseSizeMockIntegrationShould.kt index ea71ad1597..930cfdd4c3 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/dbtests/BaseLocalAnalyticsDatabaseSizeMockIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/dbtests/BaseLocalAnalyticsDatabaseSizeMockIntegrationShould.kt @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.localanalytics.dbtests @@ -134,4 +134,4 @@ internal abstract class BaseLocalAnalyticsDatabaseSizeMockIntegrationShould : Ba val count = d2.trackedEntityModule().trackedEntityDataValues().blockingCount() assertThat(count).isEqualTo(20000 * SizeFactor) } -} \ No newline at end of file +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/dbtests/LocalAnalyticsSuperLargeDatabaseMockIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/dbtests/LocalAnalyticsSuperLargeDatabaseMockIntegrationShould.kt index f9e27a8e56..e4cf23ccaf 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/dbtests/LocalAnalyticsSuperLargeDatabaseMockIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/dbtests/LocalAnalyticsSuperLargeDatabaseMockIntegrationShould.kt @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.localanalytics.dbtests @@ -36,14 +36,18 @@ import org.junit.runner.RunWith @Ignore("Tests for local analytics. Only to be executed on demand") @RunWith(D2JunitRunner::class) -internal class LocalAnalyticsSuperLargeDatabaseMockIntegrationShould : BaseLocalAnalyticsDatabaseSizeMockIntegrationShould() { +internal class LocalAnalyticsSuperLargeDatabaseMockIntegrationShould : + BaseLocalAnalyticsDatabaseSizeMockIntegrationShould() { companion object LocalAnalyticsAggregatedLargeDataMockIntegrationShould { @BeforeClass @JvmStatic fun setUpClass() { - setUpClass(LocalAnalyticsDataParams.SuperLargeFactor, MockIntegrationTestDatabaseContent.LocalAnalyticsSuperLargeDispatcher) + setUpClass( + LocalAnalyticsDataParams.SuperLargeFactor, + MockIntegrationTestDatabaseContent.LocalAnalyticsSuperLargeDispatcher + ) } } -} \ No newline at end of file +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/tests/BaseLocalAnalyticsAggregatedMockIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/tests/BaseLocalAnalyticsAggregatedMockIntegrationShould.kt index 9d2876bacb..371824e0c8 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/tests/BaseLocalAnalyticsAggregatedMockIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/tests/BaseLocalAnalyticsAggregatedMockIntegrationShould.kt @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.localanalytics.tests @@ -52,14 +52,18 @@ internal abstract class BaseLocalAnalyticsAggregatedMockIntegrationShould : Base @Test fun count_data_values_for_data_element() { val firstDataValue = d2.dataValueModule().dataValues().one().blockingGet() - val dataValuesCount = d2.dataValueModule().dataValues().byDataElementUid().eq(firstDataValue.dataElement()).blockingCount() + val dataValuesCount = d2.dataValueModule().dataValues() + .byDataElementUid().eq(firstDataValue.dataElement()) + .blockingCount() assertThat(dataValuesCount).isEqualTo(30 * SizeFactor) } @Test fun sum_data_values_for_data_element() { val dv = d2.dataValueModule().dataValues().one().blockingGet() - val dataValues = d2.dataValueModule().dataValues().byDataElementUid().eq(dv.dataElement()).blockingGet() + val dataValues = d2.dataValueModule().dataValues() + .byDataElementUid().eq(dv.dataElement()) + .blockingGet() val sum = dataValues.sumByDouble { it.value()!!.toDouble() } assertThat(sum).isFinite() } @@ -67,7 +71,9 @@ internal abstract class BaseLocalAnalyticsAggregatedMockIntegrationShould : Base @Test fun avg_data_values_for_data_element() { val dv = d2.dataValueModule().dataValues().one().blockingGet() - val dataValues = d2.dataValueModule().dataValues().byDataElementUid().eq(dv.dataElement()).blockingGet() + val dataValues = d2.dataValueModule().dataValues() + .byDataElementUid().eq(dv.dataElement()) + .blockingGet() assertThat(getAvgValue(dataValues)).isFinite() } @@ -79,14 +85,14 @@ internal abstract class BaseLocalAnalyticsAggregatedMockIntegrationShould : Base @Test fun count_data_values_for_data_element_for_ou_level_3() { val ou = d2.organisationUnitModule().organisationUnits() - .byLevel().eq(3) - .one().blockingGet() + .byLevel().eq(3) + .one().blockingGet() val firstDataValue = d2.dataValueModule().dataValues() - .one().blockingGet() + .one().blockingGet() val dataValuesCount = d2.dataValueModule().dataValues() - .byOrganisationUnitUid().eq(ou.uid()) - .byDataElementUid().eq(firstDataValue.dataElement()) - .blockingCount() + .byOrganisationUnitUid().eq(ou.uid()) + .byDataElementUid().eq(firstDataValue.dataElement()) + .blockingCount() assertThat(dataValuesCount).isEqualTo(10 * SizeFactor) } @@ -130,31 +136,31 @@ internal abstract class BaseLocalAnalyticsAggregatedMockIntegrationShould : Base private fun dataValuesForDataElementForOuAndDescendentsRepository(level: Int): DataValueCollectionRepository { val ou3 = d2.organisationUnitModule().organisationUnits() - .byLevel().eq(3) - .one().blockingGet() + .byLevel().eq(3) + .one().blockingGet() val level2Uid = ou3.path()!!.split("/")[level] val ous2AndChildren = d2.organisationUnitModule().organisationUnits() - .byPath().like(level2Uid) - .blockingGet() + .byPath().like(level2Uid) + .blockingGet() val firstDataValue = d2.dataValueModule().dataValues() - .one().blockingGet() + .one().blockingGet() return d2.dataValueModule().dataValues() - .byOrganisationUnitUid().`in`(ous2AndChildren.map { it.uid() }) - .byDataElementUid().eq(firstDataValue.dataElement()) + .byOrganisationUnitUid().`in`(ous2AndChildren.map { it.uid() }) + .byDataElementUid().eq(firstDataValue.dataElement()) } @Test fun count_data_values_for_data_element_for_ou_level_3_per_period() { val ou = d2.organisationUnitModule().organisationUnits() - .byLevel().eq(3) - .one().blockingGet() + .byLevel().eq(3) + .one().blockingGet() val firstDataValue = d2.dataValueModule().dataValues() - .one().blockingGet() + .one().blockingGet() val dataValues = d2.dataValueModule().dataValues() - .byOrganisationUnitUid().eq(ou.uid()) - .byDataElementUid().eq(firstDataValue.dataElement()) - .blockingGet() + .byOrganisationUnitUid().eq(ou.uid()) + .byDataElementUid().eq(firstDataValue.dataElement()) + .blockingGet() val dataValuesPerPeriod = dataValues.groupBy { it.period() } assertThat(dataValuesPerPeriod.size).isEqualTo(10 * SizeFactor) } -} \ No newline at end of file +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/tests/BaseLocalAnalyticsTest.kt b/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/tests/BaseLocalAnalyticsTest.kt index bc9089af4a..90cfb1022c 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/tests/BaseLocalAnalyticsTest.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/tests/BaseLocalAnalyticsTest.kt @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.localanalytics.tests @@ -47,12 +47,14 @@ abstract class BaseLocalAnalyticsTest : BaseMockIntegrationTest() { val isNewInstance = setUpClass(dispatcher) if (isNewInstance) { objects.dhis2MockServer.setRequestDispatcher() - objects.d2.userModule().blockingLogIn(RealServerMother.username, RealServerMother.password, - objects.dhis2MockServer.baseEndpoint) + objects.d2.userModule().blockingLogIn( + RealServerMother.username, RealServerMother.password, + objects.dhis2MockServer.baseEndpoint + ) } val filler = LocalAnalyticsDatabaseFiller(objects.d2) filler.fillDatabase(LocalAnalyticsMetadataParams.Default, LocalAnalyticsDataParams.get(SizeFactor)) } } -} \ No newline at end of file +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/tests/BaseLocalAnalyticsTrackerMockIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/tests/BaseLocalAnalyticsTrackerMockIntegrationShould.kt index 8d8fa0efdf..190a1dc137 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/tests/BaseLocalAnalyticsTrackerMockIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/tests/BaseLocalAnalyticsTrackerMockIntegrationShould.kt @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.localanalytics.tests @@ -43,38 +43,38 @@ internal abstract class BaseLocalAnalyticsTrackerMockIntegrationShould : BaseLoc @Test fun count_events() { val eventsCount = d2.eventModule().events() - .blockingCount() + .blockingCount() assertThat(eventsCount).isEqualTo(2000 * SizeFactor) } @Test fun count_events_for_program_with_registration() { val eventsCount = d2.eventModule().events() - .byProgramUid().eq(getProgramWithRegistration().uid()) - .blockingCount() + .byProgramUid().eq(getProgramWithRegistration().uid()) + .blockingCount() assertThat(eventsCount).isEqualTo(1500 * SizeFactor) } @Test fun count_events_for_program_without_registration() { val eventsCount = d2.eventModule().events() - .byProgramUid().eq(getProgramWithoutRegistration().uid()) - .blockingCount() + .byProgramUid().eq(getProgramWithoutRegistration().uid()) + .blockingCount() assertThat(eventsCount).isEqualTo(500 * SizeFactor) } @Test fun count_enrollments_by_program() { val enrollmentsCount = getProgramEnrollmentsRepository() - .blockingCount() + .blockingCount() assertThat(enrollmentsCount).isEqualTo(500 * SizeFactor) } @Test fun count_enrollments_by_program_and_status() { val enrollmentsCount = getProgramEnrollmentsRepository() - .byStatus().eq(EnrollmentStatus.ACTIVE) - .blockingCount() + .byStatus().eq(EnrollmentStatus.ACTIVE) + .blockingCount() assertThat(enrollmentsCount).isEqualTo(500 * SizeFactor) } @@ -87,21 +87,21 @@ internal abstract class BaseLocalAnalyticsTrackerMockIntegrationShould : BaseLoc @Test fun count_events_by_condition_on_1_tracked_entity_data_value_and_status() { val eventsCount = getEventRepositoryByTEDV(1).byStatus().eq(EventStatus.ACTIVE) - .blockingCount() + .blockingCount() assertThat(eventsCount).isAtLeast(1) } @Test fun count_events_by_condition_on_2_tracked_entity_data_values_and_status() { val eventsCount = getEventRepositoryByTEDV(2).byStatus().eq(EventStatus.ACTIVE) - .blockingCount() + .blockingCount() assertThat(eventsCount).isAtLeast(1) } @Test fun count_events_by_condition_on_3_tracked_entity_data_values_and_status() { val eventsCount = getEventRepositoryByTEDV(3).byStatus().eq(EventStatus.ACTIVE) - .blockingCount() + .blockingCount() assertThat(eventsCount).isAtLeast(1) } @@ -168,94 +168,94 @@ internal abstract class BaseLocalAnalyticsTrackerMockIntegrationShould : BaseLoc @Test fun count_tedv_for_a_data_element() { val firstTedv = d2.trackedEntityModule().trackedEntityDataValues() - .one().blockingGet() + .one().blockingGet() val tedvCount = d2.trackedEntityModule().trackedEntityDataValues() - .byDataElement().eq(firstTedv.dataElement()) - .blockingCount() + .byDataElement().eq(firstTedv.dataElement()) + .blockingCount() assertThat(tedvCount).isEqualTo(2000 * SizeFactor) } @Test fun aggregate_tedv_for_a_data_element() { val firstTedv = d2.trackedEntityModule().trackedEntityDataValues() - .one().blockingGet() + .one().blockingGet() val tedv = d2.trackedEntityModule().trackedEntityDataValues() - .byDataElement().eq(firstTedv.dataElement()) - .blockingGet() + .byDataElement().eq(firstTedv.dataElement()) + .blockingGet() val aggregatedTedv = tedv.sumBy { v -> v.value()!!.count { it == 'a' } } assertThat(aggregatedTedv).isAtLeast(1) } private fun countTeisByConditionOnTEDV(tedvCount: Int): Int { val events = getEventRepositoryByTEDV(tedvCount) - .byEnrollmentUid().isNotNull - .blockingGet() + .byEnrollmentUid().isNotNull + .blockingGet() val enrollmentUids = events.groupBy { it.enrollment() }.keys val enrollments = d2.enrollmentModule().enrollments() - .byUid().`in`(enrollmentUids) - .blockingGet() + .byUid().`in`(enrollmentUids) + .blockingGet() return enrollments.groupBy { it.trackedEntityInstance() }.size } private fun getProgramEnrollmentsRepository(): EnrollmentCollectionRepository { return d2.enrollmentModule().enrollments() - .byProgram().eq(getProgramWithRegistration().uid()) + .byProgram().eq(getProgramWithRegistration().uid()) } private fun getProgramWithRegistration(): Program { return d2.programModule().programs() - .byProgramType().eq(ProgramType.WITH_REGISTRATION) - .one() - .blockingGet() + .byProgramType().eq(ProgramType.WITH_REGISTRATION) + .one() + .blockingGet() } private fun getProgramWithoutRegistration(): Program { return d2.programModule().programs() - .byProgramType().eq(ProgramType.WITHOUT_REGISTRATION) - .one() - .blockingGet() + .byProgramType().eq(ProgramType.WITHOUT_REGISTRATION) + .one() + .blockingGet() } private fun getEventRepositoryByTEDV(tedvCount: Int): EventCollectionRepository { val dataElements = d2.dataElementModule().dataElements() - .byDomainType().eq("TRACKER") - .blockingGet() + .byDomainType().eq("TRACKER") + .blockingGet() val eventsList = (0 until tedvCount).flatMap { i -> val de = dataElements[i] val tedv = d2.trackedEntityModule().trackedEntityDataValues() - .byDataElement().eq(de.uid()) - .byValue().like("a") - .blockingGet() + .byDataElement().eq(de.uid()) + .byValue().like("a") + .blockingGet() tedv.map { it.event() } } return d2.eventModule().events() - .byUid().`in`(eventsList.toSet()) - .byStatus().eq(EventStatus.ACTIVE) + .byUid().`in`(eventsList.toSet()) + .byStatus().eq(EventStatus.ACTIVE) } private fun getTeiRepositoryByTEAV(teavCount: Int): TrackedEntityInstanceCollectionRepository { val attributes = d2.trackedEntityModule().trackedEntityAttributes() - .blockingGet() - val teisList = (0 until teavCount).flatMap { i -> + .blockingGet() + val teisList = (0 until teavCount).flatMap { i -> val tea = attributes[i] val teav = d2.trackedEntityModule().trackedEntityAttributeValues() - .byTrackedEntityAttribute().eq(tea.uid()) - .byValue().like("a") - .blockingGet() + .byTrackedEntityAttribute().eq(tea.uid()) + .byValue().like("a") + .blockingGet() teav.map { it.trackedEntityInstance() } } return d2.trackedEntityModule().trackedEntityInstances() - .byUid().`in`(teisList.toSet()) + .byUid().`in`(teisList.toSet()) } private fun countTeisByConditionOnTEDVSql(tedvCount: Int): Int { val dataElements = d2.dataElementModule().dataElements() - .byDomainType().eq("TRACKER") - .blockingGet() + .byDomainType().eq("TRACKER") + .blockingGet() val dataElementQuery = (0 until tedvCount).joinToString(" OR") { i -> val de = dataElements[i] @@ -272,7 +272,7 @@ internal abstract class BaseLocalAnalyticsTrackerMockIntegrationShould : BaseLoc private fun countTeisByConditionOnTEAVSql(teavCount: Int): Int { val attributes = d2.trackedEntityModule().trackedEntityAttributes() - .blockingGet() + .blockingGet() val attributeValuesQuery = (0 until teavCount).joinToString(" OR") { i -> val tea = attributes[i] @@ -286,7 +286,7 @@ internal abstract class BaseLocalAnalyticsTrackerMockIntegrationShould : BaseLoc } private fun getIntFromCursor(cursor: Cursor): Int { - var count = 0; + var count = 0 cursor.use { c -> if (c.count > 0) { @@ -296,4 +296,4 @@ internal abstract class BaseLocalAnalyticsTrackerMockIntegrationShould : BaseLoc } return count } -} \ No newline at end of file +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/tests/LocalAnalyticsAggregatedDefaultDataMockIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/tests/LocalAnalyticsAggregatedDefaultDataMockIntegrationShould.kt index 0ef19deb80..72aef1a7b2 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/tests/LocalAnalyticsAggregatedDefaultDataMockIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/tests/LocalAnalyticsAggregatedDefaultDataMockIntegrationShould.kt @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.localanalytics.tests @@ -36,14 +36,18 @@ import org.junit.runner.RunWith @Ignore("Tests for local analytics. Only to be executed on demand") @RunWith(D2JunitRunner::class) -internal class LocalAnalyticsAggregatedDefaultDataMockIntegrationShould : BaseLocalAnalyticsAggregatedMockIntegrationShould() { +internal class LocalAnalyticsAggregatedDefaultDataMockIntegrationShould : + BaseLocalAnalyticsAggregatedMockIntegrationShould() { companion object LocalAnalyticsAggregatedLargeDataMockIntegrationShould { @BeforeClass @JvmStatic fun setUpClass() { - setUpClass(LocalAnalyticsDataParams.DefaultFactor, MockIntegrationTestDatabaseContent.LocalAnalyticsDefaultDispatcher) + setUpClass( + LocalAnalyticsDataParams.DefaultFactor, + MockIntegrationTestDatabaseContent.LocalAnalyticsDefaultDispatcher + ) } } -} \ No newline at end of file +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/tests/LocalAnalyticsAggregatedLargeDataMockIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/tests/LocalAnalyticsAggregatedLargeDataMockIntegrationShould.kt index 01583a0cc8..e8c0e8f83f 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/tests/LocalAnalyticsAggregatedLargeDataMockIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/tests/LocalAnalyticsAggregatedLargeDataMockIntegrationShould.kt @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.localanalytics.tests @@ -36,14 +36,18 @@ import org.junit.runner.RunWith @Ignore("Tests for local analytics. Only to be executed on demand") @RunWith(D2JunitRunner::class) -internal class LocalAnalyticsAggregatedLargeDataMockIntegrationShould : BaseLocalAnalyticsAggregatedMockIntegrationShould() { +internal class LocalAnalyticsAggregatedLargeDataMockIntegrationShould : + BaseLocalAnalyticsAggregatedMockIntegrationShould() { companion object LocalAnalyticsAggregatedLargeDataMockIntegrationShould { @BeforeClass @JvmStatic fun setUpClass() { - setUpClass(LocalAnalyticsDataParams.LargeFactor, MockIntegrationTestDatabaseContent.LocalAnalyticsLargeDispatcher) + setUpClass( + LocalAnalyticsDataParams.LargeFactor, + MockIntegrationTestDatabaseContent.LocalAnalyticsLargeDispatcher + ) } } -} \ No newline at end of file +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/tests/LocalAnalyticsAggregatedSuperLargeDataMockIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/tests/LocalAnalyticsAggregatedSuperLargeDataMockIntegrationShould.kt index a3d278cdbd..b554574b00 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/tests/LocalAnalyticsAggregatedSuperLargeDataMockIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/tests/LocalAnalyticsAggregatedSuperLargeDataMockIntegrationShould.kt @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.localanalytics.tests @@ -36,14 +36,18 @@ import org.junit.runner.RunWith @Ignore("Tests for local analytics. Only to be executed on demand") @RunWith(D2JunitRunner::class) -internal class LocalAnalyticsAggregatedSuperLargeDataMockIntegrationShould : BaseLocalAnalyticsAggregatedMockIntegrationShould() { +internal class LocalAnalyticsAggregatedSuperLargeDataMockIntegrationShould : + BaseLocalAnalyticsAggregatedMockIntegrationShould() { companion object LocalAnalyticsAggregatedLargeDataMockIntegrationShould { @BeforeClass @JvmStatic fun setUpClass() { - setUpClass(LocalAnalyticsDataParams.SuperLargeFactor, MockIntegrationTestDatabaseContent.LocalAnalyticsSuperLargeDispatcher) + setUpClass( + LocalAnalyticsDataParams.SuperLargeFactor, + MockIntegrationTestDatabaseContent.LocalAnalyticsSuperLargeDispatcher + ) } } -} \ No newline at end of file +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/tests/LocalAnalyticsTrackerDefaultMockIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/tests/LocalAnalyticsTrackerDefaultMockIntegrationShould.kt index 3e2a1a7991..9f13e98f4b 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/tests/LocalAnalyticsTrackerDefaultMockIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/tests/LocalAnalyticsTrackerDefaultMockIntegrationShould.kt @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.localanalytics.tests @@ -36,14 +36,18 @@ import org.junit.runner.RunWith @Ignore("Tests for local analytics. Only to be executed on demand") @RunWith(D2JunitRunner::class) -internal class LocalAnalyticsTrackerDefaultMockIntegrationShould : BaseLocalAnalyticsTrackerMockIntegrationShould() { +internal class LocalAnalyticsTrackerDefaultMockIntegrationShould : + BaseLocalAnalyticsTrackerMockIntegrationShould() { companion object LocalAnalyticsAggregatedLargeDataMockIntegrationShould { @BeforeClass @JvmStatic fun setUpClass() { - setUpClass(LocalAnalyticsDataParams.DefaultFactor, MockIntegrationTestDatabaseContent.LocalAnalyticsDefaultDispatcher) + setUpClass( + LocalAnalyticsDataParams.DefaultFactor, + MockIntegrationTestDatabaseContent.LocalAnalyticsDefaultDispatcher + ) } } -} \ No newline at end of file +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/tests/LocalAnalyticsTrackerLargeMockIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/tests/LocalAnalyticsTrackerLargeMockIntegrationShould.kt index f12a11d996..136301a14d 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/tests/LocalAnalyticsTrackerLargeMockIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/tests/LocalAnalyticsTrackerLargeMockIntegrationShould.kt @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.localanalytics.tests @@ -36,14 +36,18 @@ import org.junit.runner.RunWith @Ignore("Tests for local analytics. Only to be executed on demand") @RunWith(D2JunitRunner::class) -internal class LocalAnalyticsTrackerLargeMockIntegrationShould : BaseLocalAnalyticsTrackerMockIntegrationShould() { +internal class LocalAnalyticsTrackerLargeMockIntegrationShould : + BaseLocalAnalyticsTrackerMockIntegrationShould() { companion object LocalAnalyticsAggregatedLargeDataMockIntegrationShould { @BeforeClass @JvmStatic fun setUpClass() { - setUpClass(LocalAnalyticsDataParams.LargeFactor, MockIntegrationTestDatabaseContent.LocalAnalyticsLargeDispatcher) + setUpClass( + LocalAnalyticsDataParams.LargeFactor, + MockIntegrationTestDatabaseContent.LocalAnalyticsLargeDispatcher + ) } } -} \ No newline at end of file +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/tests/LocalAnalyticsTrackerSuperLargeMockIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/tests/LocalAnalyticsTrackerSuperLargeMockIntegrationShould.kt index 2034cf1a9f..9ad98d25dd 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/tests/LocalAnalyticsTrackerSuperLargeMockIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/localanalytics/tests/LocalAnalyticsTrackerSuperLargeMockIntegrationShould.kt @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.localanalytics.tests @@ -36,14 +36,18 @@ import org.junit.runner.RunWith @Ignore("Tests for local analytics. Only to be executed on demand") @RunWith(D2JunitRunner::class) -internal class LocalAnalyticsTrackerSuperLargeMockIntegrationShould : BaseLocalAnalyticsTrackerMockIntegrationShould() { +internal class LocalAnalyticsTrackerSuperLargeMockIntegrationShould : + BaseLocalAnalyticsTrackerMockIntegrationShould() { companion object LocalAnalyticsAggregatedLargeDataMockIntegrationShould { @BeforeClass @JvmStatic fun setUpClass() { - setUpClass(LocalAnalyticsDataParams.SuperLargeFactor, MockIntegrationTestDatabaseContent.LocalAnalyticsSuperLargeDispatcher) + setUpClass( + LocalAnalyticsDataParams.SuperLargeFactor, + MockIntegrationTestDatabaseContent.LocalAnalyticsSuperLargeDispatcher + ) } } -} \ No newline at end of file +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/arch/helpers/FileResizerHelperShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/arch/helpers/FileResizerHelperShould.java index df6c4b57a5..520961ec61 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/arch/helpers/FileResizerHelperShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/arch/helpers/FileResizerHelperShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.arch.helpers; @@ -46,8 +46,7 @@ import java.io.FileOutputStream; import java.io.OutputStream; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) public class FileResizerHelperShould { @@ -57,14 +56,14 @@ public void resize_to_small_file() throws D2Error { File file = getFile(Bitmap.CompressFormat.PNG, getBitmap(2048, 1024)); Bitmap bitmap = BitmapFactory.decodeFile(file.getAbsolutePath()); - assertThat(bitmap.getHeight(), is(1024)); - assertThat(bitmap.getWidth(), is(2048)); + assertThat(bitmap.getHeight()).isEqualTo(1024); + assertThat(bitmap.getWidth()).isEqualTo(2048); File resizedFile = FileResizerHelper.resizeFile(file, FileResizerHelper.Dimension.SMALL); Bitmap resizedBitmap = BitmapFactory.decodeFile(resizedFile.getAbsolutePath()); - assertThat(resizedBitmap.getHeight(), is(128)); - assertThat(resizedBitmap.getWidth(), is(256)); + assertThat(resizedBitmap.getHeight()).isEqualTo(128); + assertThat(resizedBitmap.getWidth()).isEqualTo(256); } @Test @@ -72,14 +71,14 @@ public void resize_to_medium_file() throws D2Error { File file = getFile(Bitmap.CompressFormat.PNG, getBitmap(2048, 1024)); Bitmap bitmap = BitmapFactory.decodeFile(file.getAbsolutePath()); - assertThat(bitmap.getHeight(), is(1024)); - assertThat(bitmap.getWidth(), is(2048)); + assertThat(bitmap.getHeight()).isEqualTo(1024); + assertThat(bitmap.getWidth()).isEqualTo(2048); File resizedFile = FileResizerHelper.resizeFile(file, FileResizerHelper.Dimension.MEDIUM); Bitmap resizedBitmap = BitmapFactory.decodeFile(resizedFile.getAbsolutePath()); - assertThat(resizedBitmap.getHeight(), is(256)); - assertThat(resizedBitmap.getWidth(), is(512)); + assertThat(resizedBitmap.getHeight()).isEqualTo(256); + assertThat(resizedBitmap.getWidth()).isEqualTo(512); } @Test @@ -87,14 +86,14 @@ public void resize_to_large_file() throws D2Error { File file = getFile(Bitmap.CompressFormat.PNG, getBitmap(2048, 1024)); Bitmap bitmap = BitmapFactory.decodeFile(file.getAbsolutePath()); - assertThat(bitmap.getHeight(), is(1024)); - assertThat(bitmap.getWidth(), is(2048)); + assertThat(bitmap.getHeight()).isEqualTo(1024); + assertThat(bitmap.getWidth()).isEqualTo(2048); File resizedFile = FileResizerHelper.resizeFile(file, FileResizerHelper.Dimension.LARGE); Bitmap resizedBitmap = BitmapFactory.decodeFile(resizedFile.getAbsolutePath()); - assertThat(resizedBitmap.getHeight(), is(512)); - assertThat(resizedBitmap.getWidth(), is(1024)); + assertThat(resizedBitmap.getHeight()).isEqualTo(512); + assertThat(resizedBitmap.getWidth()).isEqualTo(1024); } @Test @@ -102,14 +101,14 @@ public void resize_jpeg() throws D2Error { File file = getFile(Bitmap.CompressFormat.JPEG, getBitmap(2048, 1024)); Bitmap bitmap = BitmapFactory.decodeFile(file.getAbsolutePath()); - assertThat(bitmap.getHeight(), is(1024)); - assertThat(bitmap.getWidth(), is(2048)); + assertThat(bitmap.getHeight()).isEqualTo(1024); + assertThat(bitmap.getWidth()).isEqualTo(2048); File resizedFile = FileResizerHelper.resizeFile(file, FileResizerHelper.Dimension.SMALL); Bitmap resizedBitmap = BitmapFactory.decodeFile(resizedFile.getAbsolutePath()); - assertThat(resizedBitmap.getHeight(), is(128)); - assertThat(resizedBitmap.getWidth(), is(256)); + assertThat(resizedBitmap.getHeight()).isEqualTo(128); + assertThat(resizedBitmap.getWidth()).isEqualTo(256); } @Test @@ -117,14 +116,14 @@ public void do_not_resize_small_to_large_file() throws D2Error { File file = getFile(Bitmap.CompressFormat.PNG, getBitmap(100, 125)); Bitmap bitmap = BitmapFactory.decodeFile(file.getAbsolutePath()); - assertThat(bitmap.getHeight(), is(125)); - assertThat(bitmap.getWidth(), is(100)); + assertThat(bitmap.getHeight()).isEqualTo(125); + assertThat(bitmap.getWidth()).isEqualTo(100); File resizedFile = FileResizerHelper.resizeFile(file, FileResizerHelper.Dimension.LARGE); Bitmap resizedBitmap = BitmapFactory.decodeFile(resizedFile.getAbsolutePath()); - assertThat(resizedBitmap.getHeight(), is(125)); - assertThat(resizedBitmap.getWidth(), is(100)); + assertThat(resizedBitmap.getHeight()).isEqualTo(125); + assertThat(resizedBitmap.getWidth()).isEqualTo(100); } private static File getFile(Bitmap.CompressFormat compressFormat, Bitmap bitmap) { diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/category/CategoryCollectionRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/category/CategoryCollectionRepositoryMockIntegrationShould.java index 1e92ea7918..a286fca2a3 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/category/CategoryCollectionRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/category/CategoryCollectionRepositoryMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.category; @@ -36,8 +36,7 @@ import java.util.List; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) public class CategoryCollectionRepositoryMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { @@ -45,7 +44,7 @@ public class CategoryCollectionRepositoryMockIntegrationShould extends BaseMockI @Test public void find_all() { List categories = d2.categoryModule().categories().blockingGet(); - assertThat(categories.size(), is(4)); + assertThat(categories.size()).isEqualTo(4); } @Test @@ -53,7 +52,7 @@ public void filter_by_name() { List categories = d2.categoryModule().categories() .byName().like("e") .blockingGet(); - assertThat(categories.size(), is(3)); + assertThat(categories.size()).isEqualTo(3); } @Test @@ -61,7 +60,7 @@ public void filter_by_data_dimension_type() { List categories = d2.categoryModule().categories() .byDataDimensionType().eq("DISAGGREGATION") .blockingGet(); - assertThat(categories.size(), is(4)); + assertThat(categories.size()).isEqualTo(4); } @Test @@ -70,6 +69,6 @@ public void include_category_options_as_children() { .withCategoryOptions() .uid("vGs6omsRekv") .blockingGet(); - assertThat(category.categoryOptions().size(), is(1)); + assertThat(category.categoryOptions().size()).isEqualTo(1); } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/category/CategoryComboCollectionRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/category/CategoryComboCollectionRepositoryMockIntegrationShould.java index 2c929695a3..08a4d370db 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/category/CategoryComboCollectionRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/category/CategoryComboCollectionRepositoryMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.category; @@ -41,8 +41,7 @@ import java.util.Date; import java.util.List; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) public class CategoryComboCollectionRepositoryMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { @@ -59,8 +58,8 @@ public void find_objects_with_equal_name() { CategoryComboCollectionRepository repositoryWithUpdatedScope = d2.categoryModule().categoryCombos() .byName().eq("Births"); List combos = repositoryWithUpdatedScope.blockingGet(); - assertThat(combos.size(), is(1)); - assertThat(combos.get(0).uid(), is(BIRTH_UID)); + assertThat(combos.size()).isEqualTo(1); + assertThat(combos.get(0).uid()).isEqualTo(BIRTH_UID); } @Test @@ -68,9 +67,9 @@ public void find_objects_with_children_with_equal_name() { CategoryComboCollectionRepository repositoryWithUpdatedScope = d2.categoryModule().categoryCombos() .byName().eq("Births"); List combos = repositoryWithUpdatedScope.withCategories().blockingGet(); - assertThat(combos.size(), is(1)); - assertThat(combos.get(0).uid(), is(BIRTH_UID)); - assertThat(combos.get(0).categories().isEmpty(), is(false)); + assertThat(combos.size()).isEqualTo(1); + assertThat(combos.get(0).uid()).isEqualTo(BIRTH_UID); + assertThat(combos.get(0).categories().isEmpty()).isFalse(); } @Test @@ -78,8 +77,8 @@ public void find_objects_with_equal_code() { CategoryComboCollectionRepository repositoryWithUpdatedScope = d2.categoryModule().categoryCombos() .byCode().eq("BIRTHS"); List combos = repositoryWithUpdatedScope.blockingGet(); - assertThat(combos.size(), is(1)); - assertThat(combos.get(0).uid(), is(BIRTH_UID)); + assertThat(combos.size()).isEqualTo(1); + assertThat(combos.get(0).uid()).isEqualTo(BIRTH_UID); } @Test @@ -87,8 +86,8 @@ public void find_objects_with_equal_uid() { CategoryComboCollectionRepository repositoryWithUpdatedScope = d2.categoryModule().categoryCombos() .byUid().eq("m2jTvAj5kkm"); List combos = repositoryWithUpdatedScope.blockingGet(); - assertThat(combos.size(), is(1)); - assertThat(combos.get(0).uid(), is(BIRTH_UID)); + assertThat(combos.size()).isEqualTo(1); + assertThat(combos.get(0).uid()).isEqualTo(BIRTH_UID); } @Test @@ -96,8 +95,8 @@ public void find_objects_with_equal_display_name() { CategoryComboCollectionRepository repositoryWithUpdatedScope = d2.categoryModule().categoryCombos() .byDisplayName().eq("Display name with' 'single quo'tes'"); List combos = repositoryWithUpdatedScope.blockingGet(); - assertThat(combos.size(), is(1)); - assertThat(combos.get(0).uid(), is(BIRTH_UID)); + assertThat(combos.size()).isEqualTo(1); + assertThat(combos.get(0).uid()).isEqualTo(BIRTH_UID); } @Test @@ -105,7 +104,7 @@ public void do_not_find_objects_with_wrong_equal_name() { CategoryComboCollectionRepository repositoryWithUpdatedScope = d2.categoryModule().categoryCombos() .byName().eq("Deaths"); List combos = repositoryWithUpdatedScope.blockingGet(); - assertThat(combos.isEmpty(), is(true)); + assertThat(combos.isEmpty()).isTrue(); } @Test @@ -113,7 +112,7 @@ public void do_not_find_objects_with_wrong_equal_code() { CategoryComboCollectionRepository repositoryWithUpdatedScope = d2.categoryModule().categoryCombos() .byCode().eq("DEATHS"); List combos = repositoryWithUpdatedScope.blockingGet(); - assertThat(combos.isEmpty(), is(true)); + assertThat(combos.isEmpty()).isTrue(); } @Test @@ -121,8 +120,8 @@ public void find_objects_with_like_name() { CategoryComboCollectionRepository repositoryWithUpdatedScope = d2.categoryModule().categoryCombos() .byName().like("bi"); List combos = repositoryWithUpdatedScope.blockingGet(); - assertThat(combos.size(), is(1)); - assertThat(combos.get(0).uid(), is(BIRTH_UID)); + assertThat(combos.size()).isEqualTo(1); + assertThat(combos.get(0).uid()).isEqualTo(BIRTH_UID); } @Test @@ -130,8 +129,8 @@ public void find_objects_with_like_code() { CategoryComboCollectionRepository repositoryWithUpdatedScope = d2.categoryModule().categoryCombos() .byCode().like("bi"); List combos = repositoryWithUpdatedScope.blockingGet(); - assertThat(combos.size(), is(1)); - assertThat(combos.get(0).uid(), is(BIRTH_UID)); + assertThat(combos.size()).isEqualTo(1); + assertThat(combos.get(0).uid()).isEqualTo(BIRTH_UID); } @Test @@ -140,7 +139,7 @@ public void find_objects_with_equal_created() throws ParseException { CategoryComboCollectionRepository repositoryWithUpdatedScope = d2.categoryModule().categoryCombos() .byCreated().eq(created); List combos = repositoryWithUpdatedScope.blockingGet(); - assertThat(combos.size(), is(2)); + assertThat(combos.size()).isEqualTo(2); } @Test @@ -149,8 +148,8 @@ public void find_objects_with_equal_last_updated() throws ParseException { CategoryComboCollectionRepository repositoryWithUpdatedScope = d2.categoryModule().categoryCombos() .byLastUpdated().eq(created); List combos = repositoryWithUpdatedScope.blockingGet(); - assertThat(combos.size(), is(1)); - assertThat(combos.get(0).uid(), is(BIRTH_UID)); + assertThat(combos.size()).isEqualTo(1); + assertThat(combos.get(0).uid()).isEqualTo(BIRTH_UID); } @Test @@ -159,7 +158,7 @@ public void find_objects_with_last_updated_before_date_before_both() throws Pars CategoryComboCollectionRepository repositoryWithUpdatedScope = d2.categoryModule().categoryCombos() .byLastUpdated().before(created); List combos = repositoryWithUpdatedScope.blockingGet(); - assertThat(combos.size(), is(0)); + assertThat(combos.size()).isEqualTo(0); } @Test @@ -168,8 +167,8 @@ public void find_objects_with_last_updated_before_date_in_between() throws Parse CategoryComboCollectionRepository repositoryWithUpdatedScope = d2.categoryModule().categoryCombos() .byLastUpdated().before(created); List combos = repositoryWithUpdatedScope.blockingGet(); - assertThat(combos.size(), is(1)); - assertThat(combos.get(0).uid(), is(DEFAULT_UID)); + assertThat(combos.size()).isEqualTo(1); + assertThat(combos.get(0).uid()).isEqualTo(DEFAULT_UID); } @Test @@ -178,7 +177,7 @@ public void find_objects_with_last_updated_before_date_after_both() throws Parse CategoryComboCollectionRepository repositoryWithUpdatedScope = d2.categoryModule().categoryCombos() .byLastUpdated().before(created); List combos = repositoryWithUpdatedScope.blockingGet(); - assertThat(combos.size(), is(2)); + assertThat(combos.size()).isEqualTo(2); } @Test @@ -187,7 +186,7 @@ public void find_objects_with_last_updated_after_date_before_both() throws Parse CategoryComboCollectionRepository repositoryWithUpdatedScope = d2.categoryModule().categoryCombos() .byLastUpdated().after(created); List combos = repositoryWithUpdatedScope.blockingGet(); - assertThat(combos.size(), is(2)); + assertThat(combos.size()).isEqualTo(2); } @Test @@ -196,8 +195,8 @@ public void find_objects_with_last_updated_after_date_in_between() throws ParseE CategoryComboCollectionRepository repositoryWithUpdatedScope = d2.categoryModule().categoryCombos() .byLastUpdated().after(created); List combos = repositoryWithUpdatedScope.blockingGet(); - assertThat(combos.size(), is(1)); - assertThat(combos.get(0).uid(), is(BIRTH_UID)); + assertThat(combos.size()).isEqualTo(1); + assertThat(combos.get(0).uid()).isEqualTo(BIRTH_UID); } @Test @@ -206,7 +205,7 @@ public void find_objects_with_last_updated_after_date_after_both() throws ParseE CategoryComboCollectionRepository repositoryWithUpdatedScope = d2.categoryModule().categoryCombos() .byLastUpdated().after(created); List combos = repositoryWithUpdatedScope.blockingGet(); - assertThat(combos.size(), is(0)); + assertThat(combos.size()).isEqualTo(0); } @Test @@ -216,7 +215,7 @@ public void combine_date_and_string_filters() throws ParseException { .byLastUpdated().after(created) .byName().like("t"); List combos = repositoryWithUpdatedScope.blockingGet(); - assertThat(combos.size(), is(2)); + assertThat(combos.size()).isEqualTo(2); } @Test @@ -224,8 +223,8 @@ public void find_non_default_category_combo() { CategoryComboCollectionRepository repositoryWithUpdatedScope = d2.categoryModule().categoryCombos() .byIsDefault().isFalse(); List combos = repositoryWithUpdatedScope.blockingGet(); - assertThat(combos.size(), is(1)); - assertThat(combos.get(0).uid(), is("m2jTvAj5kkm")); + assertThat(combos.size()).isEqualTo(1); + assertThat(combos.get(0).uid()).isEqualTo("m2jTvAj5kkm"); } @Test @@ -233,8 +232,8 @@ public void find_default_category_combo() { CategoryComboCollectionRepository repositoryWithUpdatedScope = d2.categoryModule().categoryCombos() .byIsDefault().isTrue(); List combos = repositoryWithUpdatedScope.blockingGet(); - assertThat(combos.size(), is(1)); - assertThat(combos.get(0).uid(), is("p0KPaWEg3cf")); + assertThat(combos.size()).isEqualTo(1); + assertThat(combos.get(0).uid()).isEqualTo("p0KPaWEg3cf"); } @Test @@ -243,7 +242,7 @@ public void include_categories_as_children() { .withCategories() .uid("m2jTvAj5kkm") .blockingGet(); - assertThat(categoryCombo.categories().size(), is(2)); + assertThat(categoryCombo.categories().size()).isEqualTo(2); } @Test @@ -252,6 +251,6 @@ public void include_category_option_combos_as_children() { .withCategoryOptionCombos() .uid("m2jTvAj5kkm") .blockingGet(); - assertThat(CategoryComboInternalAccessor.accessCategoryOptionCombos(categoryCombo).size(), is(2)); + assertThat(CategoryComboInternalAccessor.accessCategoryOptionCombos(categoryCombo).size()).isEqualTo(2); } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/category/CategoryModuleMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/category/CategoryModuleMockIntegrationShould.java index 958d99d7f3..3b1cf00142 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/category/CategoryModuleMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/category/CategoryModuleMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.category; @@ -42,8 +42,7 @@ import java.util.List; import java.util.Map; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) public class CategoryModuleMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { @@ -51,188 +50,188 @@ public class CategoryModuleMockIntegrationShould extends BaseMockIntegrationTest @Test public void allow_access_to_combos_without_children() { List combos = d2.categoryModule().categoryCombos().blockingGet(); - assertThat(combos.size(), is(2)); + assertThat(combos.size()).isEqualTo(2); for (CategoryCombo combo : combos) { - assertThat(combo.categories() == null, is(true)); - assertThat(accessCategoryOptionCombos(combo) == null, is(true)); + assertThat(combo.categories() == null).isTrue(); + assertThat(accessCategoryOptionCombos(combo) == null).isTrue(); } } @Test public void allow_access_to_combos_with_category_option_combos() { List combos = d2.categoryModule().categoryCombos().withCategoryOptionCombos().blockingGet(); - assertThat(combos.size(), is(2)); + assertThat(combos.size()).isEqualTo(2); for (CategoryCombo combo : combos) { - assertThat(accessCategoryOptionCombos(combo) == null, is(false)); + assertThat(accessCategoryOptionCombos(combo) == null).isFalse(); } } @Test public void allow_access_to_combos_with_categories() { List combos = d2.categoryModule().categoryCombos().withCategories().blockingGet(); - assertThat(combos.size(), is(2)); + assertThat(combos.size()).isEqualTo(2); for (CategoryCombo combo : combos) { - assertThat(combo.categories() == null, is(false)); + assertThat(combo.categories() == null).isFalse(); } } @Test public void allow_access_to_combo_by_uid_without_children() { CategoryCombo combo = d2.categoryModule().categoryCombos().uid("m2jTvAj5kkm").blockingGet(); - assertThat(combo.uid(), is("m2jTvAj5kkm")); - assertThat(combo.code(), is("BIRTHS")); - assertThat(combo.name(), is("Births")); - assertThat(combo.categories() == null, is(true)); - assertThat(accessCategoryOptionCombos(combo) == null, is(true)); + assertThat(combo.uid()).isEqualTo("m2jTvAj5kkm"); + assertThat(combo.code()).isEqualTo("BIRTHS"); + assertThat(combo.name()).isEqualTo("Births"); + assertThat(combo.categories() == null).isTrue(); + assertThat(accessCategoryOptionCombos(combo) == null).isTrue(); } @Test public void allow_access_to_combo_by_uid_with_category_option_combos() { CategoryCombo combo = d2.categoryModule().categoryCombos().withCategoryOptionCombos().uid("m2jTvAj5kkm").blockingGet(); - assertThat(combo.uid(), is("m2jTvAj5kkm")); - assertThat(combo.code(), is("BIRTHS")); - assertThat(combo.name(), is("Births")); + assertThat(combo.uid()).isEqualTo("m2jTvAj5kkm"); + assertThat(combo.code()).isEqualTo("BIRTHS"); + assertThat(combo.name()).isEqualTo("Births"); List optionCombos = accessCategoryOptionCombos(combo); - assertThat(optionCombos == null, is(false)); - assertThat(optionCombos.size(), is(2)); - assertThat(optionCombos.iterator().next().name(), is("Trained TBA, At PHU")); + assertThat(optionCombos == null).isFalse(); + assertThat(optionCombos.size()).isEqualTo(2); + assertThat(optionCombos.iterator().next().name()).isEqualTo("Trained TBA, At PHU"); } @Test public void dont_fail_when_asking_for_combos_without_children_when_not_in_database() { CategoryCombo combo = d2.categoryModule().categoryCombos().uid("nonExistentId").blockingGet(); - assertThat(combo == null, is(true)); + assertThat(combo == null).isTrue(); } @Test public void dont_fail_when_asking_for_combos_with_children_when_not_in_database() { CategoryCombo combo = d2.categoryModule().categoryCombos().withCategories().withCategoryOptionCombos() .uid("nonExistentId").blockingGet(); - assertThat(combo == null, is(true)); + assertThat(combo == null).isTrue(); } @Test public void allow_access_to_combo_by_uid_with_sorted_categories() { CategoryCombo combo = d2.categoryModule().categoryCombos().withCategories().uid("m2jTvAj5kkm").blockingGet(); - assertThat(combo.uid(), is("m2jTvAj5kkm")); - assertThat(combo.code(), is("BIRTHS")); - assertThat(combo.name(), is("Births")); + assertThat(combo.uid()).isEqualTo("m2jTvAj5kkm"); + assertThat(combo.code()).isEqualTo("BIRTHS"); + assertThat(combo.name()).isEqualTo("Births"); List categories = combo.categories(); - assertThat(categories == null, is(false)); - assertThat(categories.size(), is(2)); + assertThat(categories == null).isFalse(); + assertThat(categories.size()).isEqualTo(2); Category category0 = categories.get(0); - assertThat(category0.uid(), is("KfdsGBcoiCa")); - assertThat(category0.code(), is("BIRTHS_ATTENDED")); + assertThat(category0.uid()).isEqualTo("KfdsGBcoiCa"); + assertThat(category0.code()).isEqualTo("BIRTHS_ATTENDED"); Category category1 = categories.get(1); - assertThat(category1.uid(), is("cX5k9anHEHd")); - assertThat(category1.code(), is("GENDER")); + assertThat(category1.uid()).isEqualTo("cX5k9anHEHd"); + assertThat(category1.code()).isEqualTo("GENDER"); } @Test public void allow_access_to_categories_without_children() { List categories = d2.categoryModule().categories().blockingGet(); - assertThat(categories.size(), is(4)); + assertThat(categories.size()).isEqualTo(4); } @Test public void allow_access_to_category_by_uid_without_children() { Category category = d2.categoryModule().categories().uid("vGs6omsRekv").blockingGet(); - assertThat(category.uid(), is("vGs6omsRekv")); - assertThat(category.name(), is("default")); - assertThat(category.dataDimensionType(), is("DISAGGREGATION")); + assertThat(category.uid()).isEqualTo("vGs6omsRekv"); + assertThat(category.name()).isEqualTo("default"); + assertThat(category.dataDimensionType()).isEqualTo("DISAGGREGATION"); } @Test public void allow_access_to_categories_with_category_options() { List categories = d2.categoryModule().categories().withCategoryOptions().blockingGet(); - assertThat(categories.size(), is(4)); + assertThat(categories.size()).isEqualTo(4); for (Category category : categories) { - assertThat(category.categoryOptions() == null, is(false)); + assertThat(category.categoryOptions() == null).isFalse(); } } @Test public void allow_access_to_category_by_uid_with_sorted_category_options() { Category category = d2.categoryModule().categories().withCategoryOptions().uid("KfdsGBcoiCa").blockingGet(); - assertThat(category.uid(), is("KfdsGBcoiCa")); - assertThat(category.name(), is("Births attended by")); - assertThat(category.dataDimensionType(), is("DISAGGREGATION")); + assertThat(category.uid()).isEqualTo("KfdsGBcoiCa"); + assertThat(category.name()).isEqualTo("Births attended by"); + assertThat(category.dataDimensionType()).isEqualTo("DISAGGREGATION"); List categoryOptions = category.categoryOptions(); - assertThat(categoryOptions == null, is(false)); - assertThat(categoryOptions.size(), is(3)); + assertThat(categoryOptions == null).isFalse(); + assertThat(categoryOptions.size()).isEqualTo(3); CategoryOption categoryOption0 = categoryOptions.get(0); - assertThat(categoryOption0.uid(), is("TNYQzTHdoxL")); - assertThat(categoryOption0.code(), is("MCH_AIDES")); + assertThat(categoryOption0.uid()).isEqualTo("TNYQzTHdoxL"); + assertThat(categoryOption0.code()).isEqualTo("MCH_AIDES"); CategoryOption categoryOption1 = categoryOptions.get(1); - assertThat(categoryOption1.uid(), is("TXGfLxZlInA")); - assertThat(categoryOption1.code(), is("SECHN")); + assertThat(categoryOption1.uid()).isEqualTo("TXGfLxZlInA"); + assertThat(categoryOption1.code()).isEqualTo("SECHN"); CategoryOption categoryOption2 = categoryOptions.get(2); - assertThat(categoryOption2.uid(), is("uZUnebiT5DI")); - assertThat(categoryOption2.code(), is("TRAINED_TBA")); + assertThat(categoryOption2.uid()).isEqualTo("uZUnebiT5DI"); + assertThat(categoryOption2.code()).isEqualTo("TRAINED_TBA"); } @Test public void allow_access_to_category_option_combos_without_children() { List categoryOptionCombos = d2.categoryModule().categoryOptionCombos().blockingGet(); - assertThat(categoryOptionCombos.size(), is(4)); + assertThat(categoryOptionCombos.size()).isEqualTo(4); } @Test public void allow_access_to_category_option_combos_with_category_options() { List categoryOptionCombos = d2.categoryModule().categoryOptionCombos().withCategoryOptions().blockingGet(); - assertThat(categoryOptionCombos.size(), is(4)); + assertThat(categoryOptionCombos.size()).isEqualTo(4); for (CategoryOptionCombo categoryOptionCombo : categoryOptionCombos) { - assertThat(categoryOptionCombo.categoryOptions() == null, is(false)); + assertThat(categoryOptionCombo.categoryOptions() == null).isFalse(); } } @Test public void allow_access_to_category_option_combo_by_uid_without_children() { CategoryOptionCombo categoryOptionCombo = d2.categoryModule().categoryOptionCombos().uid("Gmbgme7z9BF").blockingGet(); - assertThat(categoryOptionCombo.uid(), is("Gmbgme7z9BF")); - assertThat(categoryOptionCombo.name(), is("Trained TBA, At PHU")); + assertThat(categoryOptionCombo.uid()).isEqualTo("Gmbgme7z9BF"); + assertThat(categoryOptionCombo.name()).isEqualTo("Trained TBA, At PHU"); } @Test public void allow_access_to_category_option_combo_by_uid_with_category_options() { CategoryOptionCombo categoryOptionCombo = d2.categoryModule().categoryOptionCombos() .withCategoryOptions().uid("Gmbgme7z9BF").blockingGet(); - assertThat(categoryOptionCombo.uid(), is("Gmbgme7z9BF")); - assertThat(categoryOptionCombo.name(), is("Trained TBA, At PHU")); + assertThat(categoryOptionCombo.uid()).isEqualTo("Gmbgme7z9BF"); + assertThat(categoryOptionCombo.name()).isEqualTo("Trained TBA, At PHU"); List categoryOptions = categoryOptionCombo.categoryOptions(); - assertThat(categoryOptions == null, is(false)); - assertThat(categoryOptions.size(), is(2)); + assertThat(categoryOptions == null).isFalse(); + assertThat(categoryOptions.size()).isEqualTo(2); Map categoryOptionsMap = UidsHelper.mapByUid(categoryOptions); CategoryOption categoryOption0 = categoryOptionsMap.get("uZUnebiT5DI"); - assertThat(categoryOption0.uid(), is("uZUnebiT5DI")); - assertThat(categoryOption0.name(), is("Trained TBA")); + assertThat(categoryOption0.uid()).isEqualTo("uZUnebiT5DI"); + assertThat(categoryOption0.name()).isEqualTo("Trained TBA"); CategoryOption categoryOption1 = categoryOptionsMap.get("Fp4gVHbRvEV"); - assertThat(categoryOption1.uid(), is("Fp4gVHbRvEV")); - assertThat(categoryOption1.name(), is("At PHU")); + assertThat(categoryOption1.uid()).isEqualTo("Fp4gVHbRvEV"); + assertThat(categoryOption1.name()).isEqualTo("At PHU"); } @Test public void allow_access_to_category_combos_without_children() { List categoryOptions = d2.categoryModule().categoryOptions().blockingGet(); - assertThat(categoryOptions.size(), is(8)); + assertThat(categoryOptions.size()).isEqualTo(8); } @Test public void allow_access_to_category_combo_by_uid_without_children() { CategoryOption categoryOption = d2.categoryModule().categoryOptions().uid("apsOixVZlf1").blockingGet(); - assertThat(categoryOption.uid(), is("apsOixVZlf1")); - assertThat(categoryOption.name(), is("Female")); - assertThat(categoryOption.code(), is("FMLE")); + assertThat(categoryOption.uid()).isEqualTo("apsOixVZlf1"); + assertThat(categoryOption.name()).isEqualTo("Female"); + assertThat(categoryOption.code()).isEqualTo("FMLE"); } private List accessCategoryOptionCombos(CategoryCombo categoryCombo) { diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/category/CategoryOptionComboCollectionRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/category/CategoryOptionComboCollectionRepositoryMockIntegrationShould.java index d9a220fd38..cc3ade3933 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/category/CategoryOptionComboCollectionRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/category/CategoryOptionComboCollectionRepositoryMockIntegrationShould.java @@ -1,35 +1,36 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.category; import com.google.common.collect.Lists; +import org.hisp.dhis.android.core.category.CategoryOption; import org.hisp.dhis.android.core.category.CategoryOptionCombo; import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestFullDispatcher; import org.hisp.dhis.android.core.utils.runner.D2JunitRunner; @@ -38,8 +39,7 @@ import java.util.List; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) public class CategoryOptionComboCollectionRepositoryMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { @@ -48,7 +48,7 @@ public class CategoryOptionComboCollectionRepositoryMockIntegrationShould extend public void find_all() { List categoryOptionCombos = d2.categoryModule().categoryOptionCombos() .withCategoryOptions().blockingGet(); - assertThat(categoryOptionCombos.size(), is(4)); + assertThat(categoryOptionCombos.size()).isEqualTo(4); } @Test @@ -56,7 +56,7 @@ public void filter_by_category_combo_A() { List categoryOptionCombos = d2.categoryModule().categoryOptionCombos() .byCategoryComboUid().eq("m2jTvAj5kkm") .blockingGet(); - assertThat(categoryOptionCombos.size(), is(2)); + assertThat(categoryOptionCombos.size()).isEqualTo(2); } @Test @@ -64,7 +64,7 @@ public void filter_by_category_combo_B() { List categoryOptionCombos = d2.categoryModule().categoryOptionCombos() .byCategoryComboUid().eq("p0KPaWEg3cf") .blockingGet(); - assertThat(categoryOptionCombos.size(), is(2)); + assertThat(categoryOptionCombos.size()).isEqualTo(2); } @Test @@ -72,7 +72,7 @@ public void filter_by_category_option() { List categoryOptionCombos = d2.categoryModule().categoryOptionCombos() .byCategoryOptions(Lists.newArrayList("as6ygGvUGNg")) .blockingGet(); - assertThat(categoryOptionCombos.size(), is(1)); + assertThat(categoryOptionCombos.size()).isEqualTo(1); } @Test @@ -80,7 +80,7 @@ public void filter_by_category_option_list() { List categoryOptionCombos = d2.categoryModule().categoryOptionCombos() .byCategoryOptions(Lists.newArrayList("Fp4gVHbRvEV", "uZUnebiT5DI")) .blockingGet(); - assertThat(categoryOptionCombos.size(), is(1)); + assertThat(categoryOptionCombos.size()).isEqualTo(1); } @Test @@ -88,7 +88,7 @@ public void not_find_combos_when_filter_by_less_options_than_they_have() { List categoryOptionCombos = d2.categoryModule().categoryOptionCombos() .byCategoryOptions(Lists.newArrayList("Fp4gVHbRvEV")) .blockingGet(); - assertThat(categoryOptionCombos.size(), is(0)); + assertThat(categoryOptionCombos.size()).isEqualTo(0); } @Test @@ -96,7 +96,7 @@ public void not_find_combos_when_filter_by_more_options_than_they_have() { List categoryOptionCombos = d2.categoryModule().categoryOptionCombos() .byCategoryOptions(Lists.newArrayList("as6ygGvUGNg", "Fp4gVHbRvEV", "uZUnebiT5DI")) .blockingGet(); - assertThat(categoryOptionCombos.size(), is(0)); + assertThat(categoryOptionCombos.size()).isEqualTo(0); } @Test @@ -104,27 +104,38 @@ public void not_find_combos_when_no_matching_options() { List categoryOptionCombos = d2.categoryModule().categoryOptionCombos() .byCategoryOptions(Lists.newArrayList("as6ygGvUGNg", "Fp4gVHbRvEV")) .blockingGet(); - assertThat(categoryOptionCombos.size(), is(0)); + assertThat(categoryOptionCombos.size()).isEqualTo(0); } @Test public void include_category_options_as_children() { CategoryOptionCombo categoryOptionCombo = d2.categoryModule().categoryOptionCombos() .withCategoryOptions().one().blockingGet(); - assertThat(categoryOptionCombo.categoryOptions().get(0).name(), is("At PHU")); + assertThat(categoryOptionCombo.categoryOptions().get(0).name()).isEqualTo("At PHU"); } @Test public void include_category_options_as_children_in_collection_repository_when_all_selected() { CategoryOptionCombo categoryOptionCombo = d2.categoryModule().categoryOptionCombos() .withCategoryOptions().blockingGet().get(0); - assertThat(categoryOptionCombo.categoryOptions().get(0).name(), is("At PHU")); + assertThat(categoryOptionCombo.categoryOptions().get(0).name()).isEqualTo("At PHU"); } @Test public void include_category_options_as_children_in_object_repository_when_all_selected() { CategoryOptionCombo categoryOptionCombo = d2.categoryModule().categoryOptionCombos() .withCategoryOptions().one().blockingGet(); - assertThat(categoryOptionCombo.categoryOptions().get(0).name(), is("At PHU")); + assertThat(categoryOptionCombo.categoryOptions().get(0).name()).isEqualTo("At PHU"); + } + + @Test + public void include_organisation_units_as_children() { + CategoryOption categoryOption = d2.categoryModule().categoryOptions() + .withOrganisationUnits() + .uid("as6ygGvUGNg") + .blockingGet(); + + assertThat(categoryOption.organisationUnits().size()).isEqualTo(1); + assertThat(categoryOption.organisationUnits().get(0).uid()).isEqualTo("DiszpKrYNg8"); } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/category/CategoryOptionRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/category/CategoryOptionRepositoryMockIntegrationShould.java index b8afe7a8ed..0138db1c05 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/category/CategoryOptionRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/category/CategoryOptionRepositoryMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.category; @@ -39,8 +39,7 @@ import java.util.Date; import java.util.List; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) public class CategoryOptionRepositoryMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { @@ -48,7 +47,7 @@ public class CategoryOptionRepositoryMockIntegrationShould extends BaseMockInteg @Test public void find_all() { List options = d2.categoryModule().categoryOptions().blockingGet(); - assertThat(options.size(), is(8)); + assertThat(options.size()).isEqualTo(8); } @Test @@ -57,7 +56,7 @@ public void filter_by_start_date() throws ParseException { List options = d2.categoryModule().categoryOptions() .byStartDate().eq(date) .blockingGet(); - assertThat(options.size(), is(1)); + assertThat(options.size()).isEqualTo(1); } @Test @@ -66,7 +65,7 @@ public void filter_by_end_date() throws ParseException { List options = d2.categoryModule().categoryOptions() .byEndDate().eq(date) .blockingGet(); - assertThat(options.size(), is(1)); + assertThat(options.size()).isEqualTo(1); } @Test @@ -74,7 +73,7 @@ public void filter_by_access_data_write() { List options = d2.categoryModule().categoryOptions() .byAccessDataWrite().isTrue() .blockingGet(); - assertThat(options.size(), is(5)); + assertThat(options.size()).isEqualTo(5); } @Test @@ -82,7 +81,7 @@ public void filter_by_category_uid() { List options = d2.categoryModule().categoryOptions() .byCategoryUid("KfdsGBcoiCa") .blockingGet(); - assertThat(options.size(), is(3)); + assertThat(options.size()).isEqualTo(3); } @Test @@ -90,6 +89,6 @@ public void filter_by_category_option_combo_uid() { List options = d2.categoryModule().categoryOptions() .byCategoryOptionComboUid("Gmbgme7z9BF") .blockingGet(); - assertThat(options.size(), is(2)); + assertThat(options.size()).isEqualTo(2); } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/constant/ConstantCollectionRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/constant/ConstantCollectionRepositoryMockIntegrationShould.java index ac31eac882..7b020c12ce 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/constant/ConstantCollectionRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/constant/ConstantCollectionRepositoryMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.constant; @@ -36,8 +36,7 @@ import java.util.List; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) public class ConstantCollectionRepositoryMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { @@ -45,7 +44,7 @@ public class ConstantCollectionRepositoryMockIntegrationShould extends BaseMockI @Test public void find_all() { List constants = d2.constantModule().constants().blockingGet(); - assertThat(constants.size(), is(2)); + assertThat(constants.size()).isEqualTo(2); } @Test @@ -53,6 +52,6 @@ public void filter_by_value() { List constants = d2.constantModule().constants() .byValue().eq(3.14) .blockingGet(); - assertThat(constants.size(), is(1)); + assertThat(constants.size()).isEqualTo(1); } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataapproval/DataApprovalCollectionRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataapproval/DataApprovalCollectionRepositoryMockIntegrationShould.java index 2fac205563..0c9fe0f515 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataapproval/DataApprovalCollectionRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataapproval/DataApprovalCollectionRepositoryMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.dataapproval; @@ -37,8 +37,7 @@ import java.util.List; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) public class DataApprovalCollectionRepositoryMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { @@ -47,7 +46,7 @@ public class DataApprovalCollectionRepositoryMockIntegrationShould extends BaseM public void find_all() { List dataApprovals = d2.dataSetModule().dataApprovals() .blockingGet(); - assertThat(dataApprovals.size(), is(1)); + assertThat(dataApprovals.size()).isEqualTo(1); } @Test @@ -55,7 +54,7 @@ public void filter_by_workflow() { List dataApprovals = d2.dataSetModule().dataApprovals() .byWorkflowUid().eq("rIUL3hYOjJc") .blockingGet(); - assertThat(dataApprovals.size(), is(1)); + assertThat(dataApprovals.size()).isEqualTo(1); } @Test @@ -63,7 +62,7 @@ public void filter_by_organisation_unit() { List dataApprovals = d2.dataSetModule().dataApprovals() .byOrganisationUnitUid().eq("DiszpKrYNg8") .blockingGet(); - assertThat(dataApprovals.size(), is(1)); + assertThat(dataApprovals.size()).isEqualTo(1); } @Test @@ -71,7 +70,7 @@ public void filter_by_period() { List dataApprovals = d2.dataSetModule().dataApprovals() .byPeriodId().eq("2018") .blockingGet(); - assertThat(dataApprovals.size(), is(1)); + assertThat(dataApprovals.size()).isEqualTo(1); } @Test @@ -79,7 +78,7 @@ public void filter_by_attribute_option_combo() { List dataApprovals = d2.dataSetModule().dataApprovals() .byAttributeOptionComboUid().eq("Gmbgme7z9BF") .blockingGet(); - assertThat(dataApprovals.size(), is(1)); + assertThat(dataApprovals.size()).isEqualTo(1); } @Test @@ -87,6 +86,6 @@ public void filter_by_state() { List dataApprovals = d2.dataSetModule().dataApprovals() .byState().eq(DataApprovalState.UNAPPROVED_ABOVE) .blockingGet(); - assertThat(dataApprovals.size(), is(1)); + assertThat(dataApprovals.size()).isEqualTo(1); } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataelement/DataElementCollectionRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataelement/DataElementCollectionRepositoryMockIntegrationShould.java index c65a137232..18b0ed996f 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataelement/DataElementCollectionRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataelement/DataElementCollectionRepositoryMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.dataelement; @@ -37,8 +37,7 @@ import java.util.List; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) public class DataElementCollectionRepositoryMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { @@ -47,7 +46,7 @@ public class DataElementCollectionRepositoryMockIntegrationShould extends BaseMo public void find_all() { List dataElements = d2.dataElementModule().dataElements() .blockingGet(); - assertThat(dataElements.size(), is(10)); + assertThat(dataElements.size()).isEqualTo(10); } @Test @@ -55,7 +54,7 @@ public void filter_by_value_type() { List dataElements = d2.dataElementModule().dataElements() .byValueType().eq(ValueType.TEXT) .blockingGet(); - assertThat(dataElements.size(), is(2)); + assertThat(dataElements.size()).isEqualTo(2); } @Test @@ -63,7 +62,7 @@ public void filter_by_zero_is_significant() { List dataElements = d2.dataElementModule().dataElements() .byZeroIsSignificant().isFalse() .blockingGet(); - assertThat(dataElements.size(), is(8)); + assertThat(dataElements.size()).isEqualTo(8); } @Test @@ -71,7 +70,7 @@ public void filter_by_aggregation_type() { List dataElements = d2.dataElementModule().dataElements() .byAggregationType().eq("AVERAGE") .blockingGet(); - assertThat(dataElements.size(), is(2)); + assertThat(dataElements.size()).isEqualTo(2); } @Test @@ -79,7 +78,7 @@ public void filter_by_form_name() { List dataElements = d2.dataElementModule().dataElements() .byFormName().eq("ANC Visit") .blockingGet(); - assertThat(dataElements.size(), is(2)); + assertThat(dataElements.size()).isEqualTo(2); } @Test @@ -87,7 +86,7 @@ public void filter_by_domain_type() { List dataElements = d2.dataElementModule().dataElements() .byDomainType().eq("TRACKER") .blockingGet(); - assertThat(dataElements.size(), is(10)); + assertThat(dataElements.size()).isEqualTo(10); } @Test @@ -95,7 +94,7 @@ public void filter_by_display_form_name() { List dataElements = d2.dataElementModule().dataElements() .byDisplayFormName().eq("ANC Visit") .blockingGet(); - assertThat(dataElements.size(), is(2)); + assertThat(dataElements.size()).isEqualTo(2); } @Test @@ -103,7 +102,7 @@ public void filter_by_option_set() { List dataElements = d2.dataElementModule().dataElements() .byOptionSetUid().eq("VQ2lai3OfVG") .blockingGet(); - assertThat(dataElements.size(), is(1)); + assertThat(dataElements.size()).isEqualTo(1); } @Test @@ -111,7 +110,7 @@ public void filter_by_category_combo() { List dataElements = d2.dataElementModule().dataElements() .byCategoryComboUid().eq("m2jTvAj5kkm") .blockingGet(); - assertThat(dataElements.size(), is(6)); + assertThat(dataElements.size()).isEqualTo(6); } @Test @@ -119,7 +118,7 @@ public void filter_by_field_mask() { List dataElements = d2.dataElementModule().dataElements() .byFieldMask().eq("XXXXX") .blockingGet(); - assertThat(dataElements.size(), is(1)); + assertThat(dataElements.size()).isEqualTo(1); } @Test @@ -127,7 +126,7 @@ public void filter_by_field_color() { List dataElements = d2.dataElementModule().dataElements() .byColor().eq("#600") .blockingGet(); - assertThat(dataElements.size(), is(1)); + assertThat(dataElements.size()).isEqualTo(1); } @Test @@ -135,6 +134,6 @@ public void filter_by_field_icon() { List dataElements = d2.dataElementModule().dataElements() .byIcon().eq("data-element-icon-2") .blockingGet(); - assertThat(dataElements.size(), is(1)); + assertThat(dataElements.size()).isEqualTo(1); } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetCollectionRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetCollectionRepositoryMockIntegrationShould.java index c4791f5479..a5621fcd2b 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetCollectionRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetCollectionRepositoryMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.dataset; @@ -39,8 +39,7 @@ import java.util.Collections; import java.util.List; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) public class DataSetCollectionRepositoryMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { @@ -49,7 +48,7 @@ public class DataSetCollectionRepositoryMockIntegrationShould extends BaseMockIn public void find_all() { List dataSets = d2.dataSetModule().dataSets() .blockingGet(); - assertThat(dataSets.size(), is(2)); + assertThat(dataSets.size()).isEqualTo(2); } @Test @@ -57,7 +56,7 @@ public void filter_by_period_type() { List dataSets = d2.dataSetModule().dataSets() .byPeriodType().eq(PeriodType.Monthly) .blockingGet(); - assertThat(dataSets.size(), is(2)); + assertThat(dataSets.size()).isEqualTo(2); } @Test @@ -65,7 +64,7 @@ public void filter_by_category_combo() { List dataSets = d2.dataSetModule().dataSets() .byCategoryComboUid().eq("m2jTvAj5kkm") .blockingGet(); - assertThat(dataSets.size(), is(2)); + assertThat(dataSets.size()).isEqualTo(2); } @Test @@ -73,7 +72,7 @@ public void filter_by_mobile() { List dataSets = d2.dataSetModule().dataSets() .byMobile().isFalse() .blockingGet(); - assertThat(dataSets.size(), is(1)); + assertThat(dataSets.size()).isEqualTo(1); } @Test @@ -81,7 +80,7 @@ public void filter_by_version_eq() { List dataSets = d2.dataSetModule().dataSets() .byVersion().eq(22) .blockingGet(); - assertThat(dataSets.size(), is(1)); + assertThat(dataSets.size()).isEqualTo(1); } @Test @@ -89,7 +88,7 @@ public void filter_by_version_bigger_1() { List dataSets = d2.dataSetModule().dataSets() .byVersion().biggerThan(21) .blockingGet(); - assertThat(dataSets.size(), is(1)); + assertThat(dataSets.size()).isEqualTo(1); } @Test @@ -97,7 +96,7 @@ public void filter_by_version_bigger_0() { List dataSets = d2.dataSetModule().dataSets() .byVersion().biggerThan(22) .blockingGet(); - assertThat(dataSets.size(), is(0)); + assertThat(dataSets.size()).isEqualTo(0); } @Test @@ -105,7 +104,7 @@ public void filter_by_version_smaller_0() { List dataSets = d2.dataSetModule().dataSets() .byVersion().smallerThan(21) .blockingGet(); - assertThat(dataSets.size(), is(1)); + assertThat(dataSets.size()).isEqualTo(1); } @Test @@ -113,7 +112,7 @@ public void filter_by_version_smaller_1() { List dataSets = d2.dataSetModule().dataSets() .byVersion().smallerThan(23) .blockingGet(); - assertThat(dataSets.size(), is(2)); + assertThat(dataSets.size()).isEqualTo(2); } @Test @@ -121,7 +120,7 @@ public void filter_by_expiry_days() { List dataSets = d2.dataSetModule().dataSets() .byExpiryDays().eq(1) .blockingGet(); - assertThat(dataSets.size(), is(1)); + assertThat(dataSets.size()).isEqualTo(1); } @Test @@ -129,7 +128,7 @@ public void filter_by_timely_days() { List dataSets = d2.dataSetModule().dataSets() .byTimelyDays().eq(3) .blockingGet(); - assertThat(dataSets.size(), is(1)); + assertThat(dataSets.size()).isEqualTo(1); } @Test @@ -137,7 +136,7 @@ public void filter_by_notify_completing_user() { List dataSets = d2.dataSetModule().dataSets() .byNotifyCompletingUser().isFalse() .blockingGet(); - assertThat(dataSets.size(), is(1)); + assertThat(dataSets.size()).isEqualTo(1); } @Test @@ -145,7 +144,7 @@ public void filter_by_open_future_periods() { List dataSets = d2.dataSetModule().dataSets() .byOpenFuturePeriods().eq(3) .blockingGet(); - assertThat(dataSets.size(), is(2)); + assertThat(dataSets.size()).isEqualTo(2); } @Test @@ -153,7 +152,7 @@ public void filter_by_field_combination_required() { List dataSets = d2.dataSetModule().dataSets() .byFieldCombinationRequired().isFalse() .blockingGet(); - assertThat(dataSets.size(), is(1)); + assertThat(dataSets.size()).isEqualTo(1); } @Test @@ -161,7 +160,7 @@ public void filter_by_valid_complete_only() { List dataSets = d2.dataSetModule().dataSets() .byValidCompleteOnly().isFalse() .blockingGet(); - assertThat(dataSets.size(), is(1)); + assertThat(dataSets.size()).isEqualTo(1); } @Test @@ -169,7 +168,7 @@ public void filter_by_no_value_requires_comment() { List dataSets = d2.dataSetModule().dataSets() .byNoValueRequiresComment().isTrue() .blockingGet(); - assertThat(dataSets.size(), is(1)); + assertThat(dataSets.size()).isEqualTo(1); } @Test @@ -177,7 +176,7 @@ public void filter_by_skip_offline() { List dataSets = d2.dataSetModule().dataSets() .bySkipOffline().isFalse() .blockingGet(); - assertThat(dataSets.size(), is(1)); + assertThat(dataSets.size()).isEqualTo(1); } @Test @@ -185,7 +184,7 @@ public void filter_by_data_element_decoration() { List dataSets = d2.dataSetModule().dataSets() .byDataElementDecoration().isTrue() .blockingGet(); - assertThat(dataSets.size(), is(1)); + assertThat(dataSets.size()).isEqualTo(1); } @Test @@ -193,7 +192,7 @@ public void filter_by_render_as_tabs() { List dataSets = d2.dataSetModule().dataSets() .byRenderAsTabs().isTrue() .blockingGet(); - assertThat(dataSets.size(), is(1)); + assertThat(dataSets.size()).isEqualTo(1); } @Test @@ -201,7 +200,7 @@ public void filter_by_render_horizontally() { List dataSets = d2.dataSetModule().dataSets() .byRenderHorizontally().isFalse() .blockingGet(); - assertThat(dataSets.size(), is(1)); + assertThat(dataSets.size()).isEqualTo(1); } @Test @@ -209,7 +208,7 @@ public void filter_by_access_data_write() { List dataSets = d2.dataSetModule().dataSets() .byAccessDataWrite().isTrue() .blockingGet(); - assertThat(dataSets.size(), is(2)); + assertThat(dataSets.size()).isEqualTo(2); } @Test @@ -217,7 +216,7 @@ public void filter_by_field_color() { List dataSets = d2.dataSetModule().dataSets() .byColor().eq("#000") .blockingGet(); - assertThat(dataSets.size(), is(1)); + assertThat(dataSets.size()).isEqualTo(1); } @Test @@ -225,7 +224,7 @@ public void filter_by_field_icon() { List dataSets = d2.dataSetModule().dataSets() .byIcon().eq("my-icon-name") .blockingGet(); - assertThat(dataSets.size(), is(1)); + assertThat(dataSets.size()).isEqualTo(1); } @Test @@ -233,7 +232,7 @@ public void filter_by_organisation_unit_uid() { List dataSets = d2.dataSetModule().dataSets() .byOrganisationUnitUid("DiszpKrYNg8") .blockingGet(); - assertThat(dataSets.size(), is(2)); + assertThat(dataSets.size()).isEqualTo(2); } @Test @@ -241,7 +240,7 @@ public void filter_by_organisation_unit_uid_list() { List dataSets = d2.dataSetModule().dataSets() .byOrganisationUnitList(Collections.singletonList("DiszpKrYNg8")) .blockingGet(); - assertThat(dataSets.size(), is(2)); + assertThat(dataSets.size()).isEqualTo(2); } @Test @@ -249,12 +248,12 @@ public void filter_by_orgunit_scope() { List dataSetCapture = d2.dataSetModule().dataSets() .byOrganisationUnitScope(OrganisationUnit.Scope.SCOPE_DATA_CAPTURE) .blockingGet(); - assertThat(dataSetCapture.size(), is(2)); + assertThat(dataSetCapture.size()).isEqualTo(2); List dataSetSearch = d2.dataSetModule().dataSets() .byOrganisationUnitScope(OrganisationUnit.Scope.SCOPE_TEI_SEARCH) .blockingGet(); - assertThat(dataSetSearch.size(), is(0)); + assertThat(dataSetSearch.size()).isEqualTo(0); } @Test @@ -262,7 +261,7 @@ public void include_compulsory_data_element_operands_as_children() { DataSet dataSet = d2.dataSetModule().dataSets() .withCompulsoryDataElementOperands() .one().blockingGet(); - assertThat(dataSet.compulsoryDataElementOperands().size(), is(1)); + assertThat(dataSet.compulsoryDataElementOperands().size()).isEqualTo(1); } @Test @@ -270,7 +269,7 @@ public void include_data_input_periods_as_children() { DataSet dataSet = d2.dataSetModule().dataSets() .withDataInputPeriods() .one().blockingGet(); - assertThat(dataSet.dataInputPeriods().size(), is(1)); + assertThat(dataSet.dataInputPeriods().size()).isEqualTo(1); } @Test @@ -278,7 +277,7 @@ public void include_data_set_elements_as_children() { DataSet dataSet = d2.dataSetModule().dataSets() .withDataSetElements() .one().blockingGet(); - assertThat(dataSet.dataSetElements().size(), is(1)); + assertThat(dataSet.dataSetElements().size()).isEqualTo(1); } @Test @@ -287,7 +286,7 @@ public void get_child_with_data_set_elements() { .withDataSetElements() .uid("lyLU2wR22tC") .blockingGet(); - assertThat(dataSet.dataSetElements().size(), is(1)); + assertThat(dataSet.dataSetElements().size()).isEqualTo(1); } @Test @@ -295,6 +294,6 @@ public void include_indicators_as_children() { DataSet dataSet = d2.dataSetModule().dataSets() .withIndicators() .one().blockingGet(); - assertThat(dataSet.indicators().size(), is(1)); + assertThat(dataSet.indicators().size()).isEqualTo(1); } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetCompleteRegistrationCollectionRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetCompleteRegistrationCollectionRepositoryMockIntegrationShould.java index 533440ada4..dfc96a13e7 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetCompleteRegistrationCollectionRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetCompleteRegistrationCollectionRepositoryMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.dataset; @@ -38,8 +38,7 @@ import java.text.SimpleDateFormat; import java.util.List; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) public class DataSetCompleteRegistrationCollectionRepositoryMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { @@ -52,7 +51,7 @@ public void find_all() { d2.dataSetModule().dataSetCompleteRegistrations() .blockingGet(); - assertThat(dataSetCompleteRegistrations.size(), is(3)); + assertThat(dataSetCompleteRegistrations.size()).isEqualTo(3); } @Test @@ -63,7 +62,7 @@ public void filter_by_period() { .eq("2018") .blockingGet(); - assertThat(dataSetCompleteRegistrations.size(), is(1)); + assertThat(dataSetCompleteRegistrations.size()).isEqualTo(1); } @Test @@ -74,7 +73,7 @@ public void filter_by_data_set() { .eq("lyLU2wR22tC") .blockingGet(); - assertThat(dataSetCompleteRegistrations.size(), is(3)); + assertThat(dataSetCompleteRegistrations.size()).isEqualTo(3); } @Test @@ -85,7 +84,7 @@ public void filter_by_organisation_unit() { .eq("DiszpKrYNg8") .blockingGet(); - assertThat(dataSetCompleteRegistrations.size(), is(3)); + assertThat(dataSetCompleteRegistrations.size()).isEqualTo(3); } @Test @@ -95,7 +94,7 @@ public void filter_by_attribute_option_combo() { .byAttributeOptionComboUid() .eq("bRowv6yZOF2").blockingGet(); - assertThat(dataSetCompleteRegistrations.size(), is(3)); + assertThat(dataSetCompleteRegistrations.size()).isEqualTo(3); } @Test @@ -106,7 +105,7 @@ public void filter_by_date_after() throws ParseException { .after(simpleDateFormat.parse("2010-08-03")) .blockingGet(); - assertThat(dataSetCompleteRegistrations.size(), is(1)); + assertThat(dataSetCompleteRegistrations.size()).isEqualTo(1); } @Test @@ -117,7 +116,7 @@ public void filter_by_date_before() throws ParseException { .before(simpleDateFormat.parse("2010-08-03")) .blockingGet(); - assertThat(dataSetCompleteRegistrations.size(), is(2)); + assertThat(dataSetCompleteRegistrations.size()).isEqualTo(2); } @Test @@ -128,7 +127,7 @@ public void filter_by_stored_by() { .eq("imported") .blockingGet(); - assertThat(dataSetCompleteRegistrations.size(), is(2)); + assertThat(dataSetCompleteRegistrations.size()).isEqualTo(2); } @Test @@ -138,7 +137,7 @@ public void filter_by_deleted() { .byDeleted().isFalse() .blockingGet(); - assertThat(dataSetCompleteRegistrations.size(), is(3)); + assertThat(dataSetCompleteRegistrations.size()).isEqualTo(3); } } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetCompleteRegistrationObjectRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetCompleteRegistrationObjectRepositoryMockIntegrationShould.java index f1e8e08af5..5e29fa7250 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetCompleteRegistrationObjectRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetCompleteRegistrationObjectRepositoryMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.dataset; @@ -36,8 +36,7 @@ import org.junit.Assert; import org.junit.Test; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; @@ -57,8 +56,8 @@ public void delete() { DataSetCompleteRegistration dataSetCompleteRegistration = objectRepository().blockingGet(); - assertThat(dataSetCompleteRegistration.deleted(), is(true)); - assertThat(dataSetCompleteRegistration.state(), is(State.TO_UPDATE)); + assertThat(dataSetCompleteRegistration.deleted()).isTrue(); + assertThat(dataSetCompleteRegistration.state()).isEqualTo(State.TO_UPDATE); } @Test diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetInstanceCollectionRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetInstanceCollectionRepositoryMockIntegrationShould.java index 5938eb2f86..74e7afb12e 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetInstanceCollectionRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetInstanceCollectionRepositoryMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.dataset; @@ -39,10 +39,7 @@ import java.text.ParseException; import java.util.List; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; -import static org.hamcrest.core.IsNull.notNullValue; -import static org.hamcrest.core.IsNull.nullValue; +import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) public class DataSetInstanceCollectionRepositoryMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { @@ -51,7 +48,7 @@ public class DataSetInstanceCollectionRepositoryMockIntegrationShould extends Ba public void find_all() { List dataSetInstances = d2.dataSetModule().dataSetInstances() .blockingGet(); - assertThat(dataSetInstances.size(), is(4)); + assertThat(dataSetInstances.size()).isEqualTo(4); } @Test @@ -59,7 +56,7 @@ public void filter_by_dataset() { List dataSetInstances = d2.dataSetModule().dataSetInstances() .byDataSetUid().eq("lyLU2wR22tC") .blockingGet(); - assertThat(dataSetInstances.size(), is(4)); + assertThat(dataSetInstances.size()).isEqualTo(4); } @Test @@ -67,7 +64,7 @@ public void filter_by_period() { List dataSetInstances = d2.dataSetModule().dataSetInstances() .byPeriod().eq("2018") .blockingGet(); - assertThat(dataSetInstances.size(), is(1)); + assertThat(dataSetInstances.size()).isEqualTo(1); } @Test @@ -75,7 +72,7 @@ public void filter_by_period_type() { List dataSetInstances = d2.dataSetModule().dataSetInstances() .byPeriodType().eq(PeriodType.Yearly) .blockingGet(); - assertThat(dataSetInstances.size(), is(3)); + assertThat(dataSetInstances.size()).isEqualTo(3); } @Test @@ -83,7 +80,7 @@ public void filter_by_period_start_date() throws ParseException { List dataSetInstances = d2.dataSetModule().dataSetInstances() .byPeriodStartDate().after(BaseIdentifiableObject.parseDate("2018-07-15T00:00:00.000")) .blockingGet(); - assertThat(dataSetInstances.size(), is(1)); + assertThat(dataSetInstances.size()).isEqualTo(1); } @Test @@ -91,7 +88,7 @@ public void filter_by_period_end_date() throws ParseException { List dataSetInstances = d2.dataSetModule().dataSetInstances() .byPeriodEndDate().after(BaseIdentifiableObject.parseDate("2018-07-15T00:00:00.000")) .blockingGet(); - assertThat(dataSetInstances.size(), is(2)); + assertThat(dataSetInstances.size()).isEqualTo(2); } @Test @@ -99,7 +96,7 @@ public void filter_by_organisation_unit() { List dataSetInstances = d2.dataSetModule().dataSetInstances() .byOrganisationUnitUid().eq("DiszpKrYNg8") .blockingGet(); - assertThat(dataSetInstances.size(), is(4)); + assertThat(dataSetInstances.size()).isEqualTo(4); } @Test @@ -107,14 +104,14 @@ public void fill_completion_information() { List dataSetInstanceCompleted = d2.dataSetModule().dataSetInstances() .byPeriod().eq("2018") .blockingGet(); - assertThat(dataSetInstanceCompleted.get(0).completed(), is(true)); - assertThat(dataSetInstanceCompleted.get(0).completionDate(), is(notNullValue())); + assertThat(dataSetInstanceCompleted.get(0).completed()).isTrue(); + assertThat(dataSetInstanceCompleted.get(0).completionDate()).isNotNull(); List dataSetInstanceUncompleted = d2.dataSetModule().dataSetInstances() .byPeriod().eq("201907") .blockingGet(); - assertThat(dataSetInstanceUncompleted.get(0).completed(), is(false)); - assertThat(dataSetInstanceUncompleted.get(0).completionDate(), is(nullValue())); + assertThat(dataSetInstanceUncompleted.get(0).completed()).isFalse(); + assertThat(dataSetInstanceUncompleted.get(0).completionDate()).isNull(); } @Test @@ -122,8 +119,8 @@ public void does_not_include_values_with_other_coc() { List dataSetInstances = d2.dataSetModule().dataSetInstances() .byPeriod().eq("201907") .blockingGet(); - assertThat(dataSetInstances.size(), is(1)); - assertThat(dataSetInstances.get(0).valueCount(), is(1)); + assertThat(dataSetInstances.size()).isEqualTo(1); + assertThat(dataSetInstances.get(0).valueCount()).isEqualTo(1); } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetInstanceSummaryCollectionRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetInstanceSummaryCollectionRepositoryMockIntegrationShould.java index e95f94f885..a3fd8a0e84 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetInstanceSummaryCollectionRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetInstanceSummaryCollectionRepositoryMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.dataset; @@ -39,8 +39,7 @@ import java.text.ParseException; import java.util.List; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) public class DataSetInstanceSummaryCollectionRepositoryMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { @@ -49,12 +48,12 @@ public class DataSetInstanceSummaryCollectionRepositoryMockIntegrationShould ext public void find_all() { List summaries = d2.dataSetModule().dataSetInstanceSummaries() .blockingGet(); - assertThat(summaries.size(), is(2)); + assertThat(summaries.size()).isEqualTo(2); for (DataSetInstanceSummary summary : summaries) { if (summary.dataSetUid().equals("lyLU2wR22tC")) { - assertThat(summary.dataSetInstanceCount(), is(4)); - assertThat(summary.valueCount(), is(4)); + assertThat(summary.dataSetInstanceCount()).isEqualTo(4); + assertThat(summary.valueCount()).isEqualTo(4); } } } @@ -64,12 +63,12 @@ public void filter_by_dataset() { List summaries = d2.dataSetModule().dataSetInstanceSummaries() .byDataSetUid().eq("lyLU2wR22tC") .blockingGet(); - assertThat(summaries.size(), is(2)); + assertThat(summaries.size()).isEqualTo(2); for (DataSetInstanceSummary summary : summaries) { if (!summary.dataSetUid().equals("lyLU2wR22tC")) { - assertThat(summary.dataSetInstanceCount(), is(0)); - assertThat(summary.valueCount(), is(0)); + assertThat(summary.dataSetInstanceCount()).isEqualTo(0); + assertThat(summary.valueCount()).isEqualTo(0); } } } @@ -79,12 +78,12 @@ public void filter_by_period() { List summaries = d2.dataSetModule().dataSetInstanceSummaries() .byPeriod().eq("2018") .blockingGet(); - assertThat(summaries.size(), is(2)); + assertThat(summaries.size()).isEqualTo(2); for (DataSetInstanceSummary summary : summaries) { if (!summary.dataSetUid().equals("lyLU2wR22tC")) { - assertThat(summary.dataSetInstanceCount(), is(0)); - assertThat(summary.valueCount(), is(0)); + assertThat(summary.dataSetInstanceCount()).isEqualTo(0); + assertThat(summary.valueCount()).isEqualTo(0); } } } @@ -94,7 +93,7 @@ public void filter_by_period_type() { List summaries = d2.dataSetModule().dataSetInstanceSummaries() .byPeriodType().eq(PeriodType.Yearly) .blockingGet(); - assertThat(summaries.size(), is(2)); + assertThat(summaries.size()).isEqualTo(2); } @Test @@ -102,7 +101,7 @@ public void filter_by_period_start_date() throws ParseException { List summaries = d2.dataSetModule().dataSetInstanceSummaries() .byPeriodStartDate().after(BaseIdentifiableObject.parseDate("2018-07-15T00:00:00.000")) .blockingGet(); - assertThat(summaries.size(), is(2)); + assertThat(summaries.size()).isEqualTo(2); } @Test @@ -110,7 +109,7 @@ public void filter_by_period_end_date() throws ParseException { List summaries = d2.dataSetModule().dataSetInstanceSummaries() .byPeriodEndDate().after(BaseIdentifiableObject.parseDate("2018-07-15T00:00:00.000")) .blockingGet(); - assertThat(summaries.size(), is(2)); + assertThat(summaries.size()).isEqualTo(2); } @Test @@ -118,12 +117,12 @@ public void filter_by_organisation_unit() { List summaries = d2.dataSetModule().dataSetInstanceSummaries() .byOrganisationUnitUid().eq("DiszpKrYNg8") .blockingGet(); - assertThat(summaries.size(), is(2)); + assertThat(summaries.size()).isEqualTo(2); for (DataSetInstanceSummary summary : summaries) { if (!summary.dataSetUid().equals("lyLU2wR22tC")) { - assertThat(summary.dataSetInstanceCount(), is(0)); - assertThat(summary.valueCount(), is(0)); + assertThat(summary.dataSetInstanceCount()).isEqualTo(0); + assertThat(summary.valueCount()).isEqualTo(0); } } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetModuleMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetModuleMockIntegrationShould.java index 7bedca2eae..4e996bda8a 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetModuleMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/DataSetModuleMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.dataset; @@ -41,8 +41,7 @@ import java.util.List; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) public class DataSetModuleMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { @@ -50,77 +49,77 @@ public class DataSetModuleMockIntegrationShould extends BaseMockIntegrationTestF @Test public void allow_access_to_all_data_sets_without_children() { List dataSets = d2.dataSetModule().dataSets().blockingGet(); - assertThat(dataSets.size(), is(2)); + assertThat(dataSets.size()).isEqualTo(2); for (DataSet dataSet : dataSets) { - assertThat(dataSet.dataSetElements() == null, is(true)); + assertThat(dataSet.dataSetElements() == null).isTrue(); } } @Test public void allow_access_to_one_data_set_without_children() { DataSet dataSet = d2.dataSetModule().dataSets().uid("lyLU2wR22tC").blockingGet(); - assertThat(dataSet.dataSetElements() == null, is(true)); + assertThat(dataSet.dataSetElements() == null).isTrue(); } @Test public void allow_access_to_all_data_sets_with_children() { List dataSets = d2.dataSetModule().dataSets().withDataSetElements().blockingGet(); - assertThat(dataSets.size(), is(2)); + assertThat(dataSets.size()).isEqualTo(2); for (DataSet dataSet : dataSets) { - assertThat(dataSet.dataSetElements() == null, is(false)); + assertThat(dataSet.dataSetElements() == null).isFalse(); } } @Test public void allow_access_to_one_data_set_with_children() { DataSet dataSet = d2.dataSetModule().dataSets().withDataSetElements().uid("lyLU2wR22tC").blockingGet(); - assertThat(dataSet.dataSetElements() == null, is(false)); + assertThat(dataSet.dataSetElements() == null).isFalse(); } @Test public void allow_access_to_compulsory_data_element_operands() { DataSet dataSet = d2.dataSetModule().dataSets().withCompulsoryDataElementOperands().uid("lyLU2wR22tC").blockingGet(); List dataElementOperands = dataSet.compulsoryDataElementOperands(); - assertThat(dataElementOperands.size(), is(1)); + assertThat(dataElementOperands.size()).isEqualTo(1); DataElementOperand operand = dataElementOperands.get(0); - assertThat(operand.uid(), is("g9eOBujte1U.Gmbgme7z9BF")); - assertThat(operand.dataElement().uid(), is("g9eOBujte1U")); - assertThat(operand.categoryOptionCombo().uid(), is("Gmbgme7z9BF")); + assertThat(operand.uid()).isEqualTo("g9eOBujte1U.Gmbgme7z9BF"); + assertThat(operand.dataElement().uid()).isEqualTo("g9eOBujte1U"); + assertThat(operand.categoryOptionCombo().uid()).isEqualTo("Gmbgme7z9BF"); } @Test public void allow_access_data_input_periods() { DataSet dataSet = d2.dataSetModule().dataSets().withDataInputPeriods().uid("lyLU2wR22tC").blockingGet(); List dataInputPeriods = dataSet.dataInputPeriods(); - assertThat(dataInputPeriods.size(), is(1)); + assertThat(dataInputPeriods.size()).isEqualTo(1); DataInputPeriod diPeriod = dataInputPeriods.get(0); - assertThat(diPeriod.period().uid(), is("2019")); - assertThat(BaseIdentifiableObject.dateToDateStr(diPeriod.openingDate()), is("2017-12-31T23:00:00.000")); - assertThat(BaseIdentifiableObject.dateToDateStr(diPeriod.closingDate()), is("2018-01-09T23:00:00.000")); + assertThat(diPeriod.period().uid()).isEqualTo("2019"); + assertThat(BaseIdentifiableObject.dateToDateStr(diPeriod.openingDate())).isEqualTo("2017-12-31T23:00:00.000"); + assertThat(BaseIdentifiableObject.dateToDateStr(diPeriod.closingDate())).isEqualTo("2018-01-09T23:00:00.000"); } @Test public void allow_access_data_set_elements() { DataSet dataSet = d2.dataSetModule().dataSets().withDataSetElements().uid("lyLU2wR22tC").blockingGet(); List dataSetElements = dataSet.dataSetElements(); - assertThat(dataSetElements.size(), is(1)); + assertThat(dataSetElements.size()).isEqualTo(1); DataSetElement dataSetElement = dataSetElements.get(0); - assertThat(dataSetElement.dataSet().uid(), is("lyLU2wR22tC")); - assertThat(dataSetElement.dataElement().uid(), is("g9eOBujte1U")); - assertThat(dataSetElement.categoryCombo().uid(), is("m2jTvAj5kkm")); + assertThat(dataSetElement.dataSet().uid()).isEqualTo("lyLU2wR22tC"); + assertThat(dataSetElement.dataElement().uid()).isEqualTo("g9eOBujte1U"); + assertThat(dataSetElement.categoryCombo().uid()).isEqualTo("m2jTvAj5kkm"); } @Test public void allow_access_indicators() { DataSet dataSet = d2.dataSetModule().dataSets().withIndicators().uid("lyLU2wR22tC").blockingGet(); List indicators = dataSet.indicators(); - assertThat(indicators.size(), is(1)); + assertThat(indicators.size()).isEqualTo(1); Indicator indicator = indicators.get(0); - assertThat(indicator.uid(), is("ReUHfIn0pTQ")); - assertThat(indicator.name(), is("ANC 1-3 Dropout Rate")); + assertThat(indicator.uid()).isEqualTo("ReUHfIn0pTQ"); + assertThat(indicator.name()).isEqualTo("ANC 1-3 Dropout Rate"); } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/SectionCollectionRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/SectionCollectionRepositoryMockIntegrationShould.java index 68c803ecb6..be81bb88ad 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/SectionCollectionRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/dataset/SectionCollectionRepositoryMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.dataset; @@ -36,8 +36,7 @@ import java.util.List; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) public class SectionCollectionRepositoryMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { @@ -45,8 +44,8 @@ public class SectionCollectionRepositoryMockIntegrationShould extends BaseMockIn @Test public void find_all_objects() { List
sections = d2.dataSetModule().sections().blockingGet(); - assertThat(sections.size(), is(1)); - assertThat(sections.get(0).name(), is("Immunization")); + assertThat(sections.size()).isEqualTo(1); + assertThat(sections.get(0).name()).isEqualTo("Immunization"); } @Test @@ -54,7 +53,7 @@ public void filter_by_description() { List
sections = d2.dataSetModule().sections() .byDescription().eq("Immunization dose administration") .blockingGet(); - assertThat(sections.size(), is(1)); + assertThat(sections.size()).isEqualTo(1); } @Test @@ -62,7 +61,7 @@ public void filter_by_sort_order() { List
sections = d2.dataSetModule().sections() .bySortOrder().eq(1) .blockingGet(); - assertThat(sections.size(), is(1)); + assertThat(sections.size()).isEqualTo(1); } @Test @@ -70,7 +69,7 @@ public void filter_by_show_row_totals() { List
sections = d2.dataSetModule().sections() .byShowRowTotals().isTrue() .blockingGet(); - assertThat(sections.size(), is(1)); + assertThat(sections.size()).isEqualTo(1); } @Test @@ -78,7 +77,7 @@ public void filter_by_show_column_totals() { List
sections = d2.dataSetModule().sections() .byShowColumnTotals().isFalse() .blockingGet(); - assertThat(sections.size(), is(1)); + assertThat(sections.size()).isEqualTo(1); } @Test @@ -86,23 +85,32 @@ public void filter_by_data_set_uid() { List
sections = d2.dataSetModule().sections() .byDataSetUid().eq("lyLU2wR22tC") .blockingGet(); - assertThat(sections.size(), is(1)); + assertThat(sections.size()).isEqualTo(1); } @Test public void return_greyed_fields_as_children() { Section section = d2.dataSetModule().sections() .withGreyedFields().one().blockingGet(); - assertThat(section.greyedFields().size(), is(1)); - assertThat(section.greyedFields().get(0).uid(), is("ca8lfO062zg.Prlt0C1RF0s")); + assertThat(section.greyedFields().size()).isEqualTo(1); + assertThat(section.greyedFields().get(0).uid()).isEqualTo("ca8lfO062zg.Prlt0C1RF0s"); } @Test public void return_data_element_as_children() { Section section = d2.dataSetModule().sections() .withDataElements().one().blockingGet(); - assertThat(section.dataElements().size(), is(1)); - assertThat(section.dataElements().get(0).uid(), is("g9eOBujte1U")); - assertThat(section.dataElements().get(0).code(), is("DE_2005735")); + assertThat(section.dataElements().size()).isEqualTo(1); + assertThat(section.dataElements().get(0).uid()).isEqualTo("g9eOBujte1U"); + assertThat(section.dataElements().get(0).code()).isEqualTo("DE_2005735"); + } + + @Test + public void return_indicators_as_children() { + Section section = d2.dataSetModule().sections() + .withIndicators().one().blockingGet(); + assertThat(section.indicators().size()).isEqualTo(1); + assertThat(section.indicators().get(0).uid()).isEqualTo("ReUHfIn0pTQ"); + assertThat(section.indicators().get(0).code()).isEqualTo("IN_52462"); } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/datavalue/DataValueCollectionRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/datavalue/DataValueCollectionRepositoryMockIntegrationShould.java index afb85b7531..ff6076c45b 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/datavalue/DataValueCollectionRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/datavalue/DataValueCollectionRepositoryMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.datavalue; @@ -40,8 +40,7 @@ import java.text.ParseException; import java.util.List; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) public class DataValueCollectionRepositoryMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { @@ -52,7 +51,7 @@ public void find_all() { d2.dataValueModule().dataValues() .blockingGet(); - assertThat(dataValues.size(), is(5)); + assertThat(dataValues.size()).isEqualTo(5); } @Test @@ -63,7 +62,7 @@ public void filter_by_data_element() { .eq("g9eOBujte1U") .blockingGet(); - assertThat(dataValues.size(), is(5)); + assertThat(dataValues.size()).isEqualTo(5); } @Test @@ -74,7 +73,7 @@ public void filter_by_period() { .eq("2018") .blockingGet(); - assertThat(dataValues.size(), is(1)); + assertThat(dataValues.size()).isEqualTo(1); } @Test @@ -85,7 +84,7 @@ public void filter_by_organisation_unit() { .eq("DiszpKrYNg8") .blockingGet(); - assertThat(dataValues.size(), is(5)); + assertThat(dataValues.size()).isEqualTo(5); } @Test @@ -96,7 +95,7 @@ public void filter_by_category_option_combo() { .eq("Gmbgme7z9BF") .blockingGet(); - assertThat(dataValues.size(), is(4)); + assertThat(dataValues.size()).isEqualTo(4); } @Test @@ -107,7 +106,7 @@ public void filter_by_attribute_option_combo() { .eq("bRowv6yZOF2") .blockingGet(); - assertThat(dataValues.size(), is(5)); + assertThat(dataValues.size()).isEqualTo(5); } @Test @@ -118,7 +117,7 @@ public void filter_by_value() { .eq("11") .blockingGet(); - assertThat(dataValues.size(), is(1)); + assertThat(dataValues.size()).isEqualTo(1); } @Test @@ -129,7 +128,7 @@ public void filter_by_stored_by() { .eq("android") .blockingGet(); - assertThat(dataValues.size(), is(2)); + assertThat(dataValues.size()).isEqualTo(2); } @Test @@ -140,7 +139,7 @@ public void filter_by_created() throws ParseException { .eq(BaseIdentifiableObject.DATE_FORMAT.parse("2010-02-11T00:00:00.000+0100")) .blockingGet(); - assertThat(dataValues.size(), is(1)); + assertThat(dataValues.size()).isEqualTo(1); } @Test @@ -151,7 +150,7 @@ public void filter_by_last_updated() throws ParseException { .eq(BaseIdentifiableObject.DATE_FORMAT.parse("2011-01-11T00:00:00.000+0000")) .blockingGet(); - assertThat(dataValues.size(), is(1)); + assertThat(dataValues.size()).isEqualTo(1); } @Test @@ -162,7 +161,7 @@ public void filter_by_comment() { .eq("Relevant comment") .blockingGet(); - assertThat(dataValues.size(), is(1)); + assertThat(dataValues.size()).isEqualTo(1); } @Test @@ -173,7 +172,7 @@ public void filter_by_follow_up() { .isFalse() .blockingGet(); - assertThat(dataValues.size(), is(4)); + assertThat(dataValues.size()).isEqualTo(4); } @Test @@ -183,7 +182,7 @@ public void filter_by_state() { .byState().eq(State.SYNCED) .blockingGet(); - assertThat(dataValues.size(), is(5)); + assertThat(dataValues.size()).isEqualTo(5); } @Test @@ -193,7 +192,17 @@ public void filter_by_deleted() { .byDeleted().isFalse() .blockingGet(); - assertThat(dataValues.size(), is(5)); + assertThat(dataValues.size()).isEqualTo(5); + } + + @Test + public void filter_by_dataset() { + List dataValues = + d2.dataValueModule().dataValues() + .byDataSetUid("lyLU2wR22tC") + .blockingGet(); + + assertThat(dataValues.size()).isEqualTo(4); } @Test @@ -201,7 +210,7 @@ public void return_data_value_object_repository() { DataValueObjectRepository objectRepository = d2.dataValueModule().dataValues() .value("2018", "DiszpKrYNg8", "g9eOBujte1U", "Gmbgme7z9BF", "bRowv6yZOF2"); - assertThat(objectRepository.blockingExists(), is(Boolean.TRUE)); - assertThat(objectRepository.blockingGet().value(), is("10")); + assertThat(objectRepository.blockingExists()).isEqualTo(Boolean.TRUE); + assertThat(objectRepository.blockingGet().value()).isEqualTo("10"); } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/datavalue/DataValueObjectRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/datavalue/DataValueObjectRepositoryMockIntegrationShould.java index b1a7bb7df3..d314b92e5d 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/datavalue/DataValueObjectRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/datavalue/DataValueObjectRepositoryMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.datavalue; @@ -37,8 +37,7 @@ import org.junit.Test; import org.junit.runner.RunWith; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) public class DataValueObjectRepositoryMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { @@ -50,7 +49,7 @@ public void update_value() throws D2Error { DataValueObjectRepository repository = objectRepository(); repository.blockingSet(value); - assertThat(repository.blockingGet().value(), is(value)); + assertThat(repository.blockingGet().value()).isEqualTo(value); repository.blockingDelete(); } @@ -62,7 +61,7 @@ public void update_follow_up() throws D2Error { DataValueObjectRepository repository = objectRepository(); repository.setFollowUp(followUp); - assertThat(repository.blockingGet().followUp(), is(followUp)); + assertThat(repository.blockingGet().followUp()).isEqualTo(followUp); repository.blockingDelete(); } @@ -74,7 +73,7 @@ public void update_comment() throws D2Error { DataValueObjectRepository repository = objectRepository(); repository.setComment(comment); - assertThat(repository.blockingGet().comment(), is(comment)); + assertThat(repository.blockingGet().comment()).isEqualTo(comment); repository.blockingDelete(); } @@ -84,10 +83,10 @@ public void delete_value_if_state_to_post() throws D2Error { DataValueObjectRepository repository = objectRepository(); repository.blockingSet("value"); - assertThat(repository.blockingExists(), is(Boolean.TRUE)); - assertThat(repository.blockingGet().state(), is(State.TO_POST)); + assertThat(repository.blockingExists()).isEqualTo(Boolean.TRUE); + assertThat(repository.blockingGet().state()).isEqualTo(State.TO_POST); repository.blockingDelete(); - assertThat(repository.blockingExists(), is(Boolean.FALSE)); + assertThat(repository.blockingExists()).isEqualTo(Boolean.FALSE); } @Test @@ -96,12 +95,12 @@ public void set_state_to_delete_if_state_is_not_to_post() throws D2Error { repository.blockingSet("value"); DataValueStore.create(databaseAdapter).setState(repository.blockingGet(), State.ERROR); - assertThat(repository.blockingExists(), is(Boolean.TRUE)); - assertThat(repository.blockingGet().state(), is(State.ERROR)); + assertThat(repository.blockingExists()).isEqualTo(Boolean.TRUE); + assertThat(repository.blockingGet().state()).isEqualTo(State.ERROR); repository.blockingDelete(); - assertThat(repository.blockingExists(), is(Boolean.TRUE)); - assertThat(repository.blockingGet().deleted(), is(Boolean.TRUE)); - assertThat(repository.blockingGet().state(), is(State.TO_UPDATE)); + assertThat(repository.blockingExists()).isEqualTo(Boolean.TRUE); + assertThat(repository.blockingGet().deleted()).isEqualTo(Boolean.TRUE); + assertThat(repository.blockingGet().state()).isEqualTo(State.TO_UPDATE); } @Test @@ -112,22 +111,22 @@ public void set_not_deleted_when_updating_deleted_value() throws D2Error { DataValueStore.create(databaseAdapter).setState(repository.blockingGet(), State.TO_UPDATE); repository.blockingDelete(); - assertThat(repository.blockingGet().state(), is(State.TO_UPDATE)); - assertThat(repository.blockingGet().deleted(), is(Boolean.TRUE)); + assertThat(repository.blockingGet().state()).isEqualTo(State.TO_UPDATE); + assertThat(repository.blockingGet().deleted()).isEqualTo(Boolean.TRUE); repository.blockingSet("new_value"); - assertThat(repository.blockingGet().state(), is(State.TO_UPDATE)); - assertThat(repository.blockingGet().deleted(), is(Boolean.FALSE)); + assertThat(repository.blockingGet().state()).isEqualTo(State.TO_UPDATE); + assertThat(repository.blockingGet().deleted()).isEqualTo(Boolean.FALSE); } @Test public void return_that_a_value_exists_only_if_it_has_been_created() { assertThat(d2.dataValueModule().dataValues() .value("no_period", "no_org_unit", "no_data_element", - "no_category", "no_attribute").blockingExists(), is(Boolean.FALSE)); + "no_category", "no_attribute").blockingExists()).isEqualTo(Boolean.FALSE); assertThat(d2.dataValueModule().dataValues() .value("2018", "DiszpKrYNg8", "g9eOBujte1U", - "Gmbgme7z9BF", "bRowv6yZOF2").blockingExists(), is(Boolean.TRUE)); + "Gmbgme7z9BF", "bRowv6yZOF2").blockingExists()).isEqualTo(Boolean.TRUE); } private DataValueObjectRepository objectRepository() { diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/enrollment/EnrollmentCollectionRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/enrollment/EnrollmentCollectionRepositoryMockIntegrationShould.java index 89a5dbc9b2..057724e4ae 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/enrollment/EnrollmentCollectionRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/enrollment/EnrollmentCollectionRepositoryMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.enrollment; @@ -45,8 +45,7 @@ import java.util.Date; import java.util.List; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) public class EnrollmentCollectionRepositoryMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { @@ -54,18 +53,18 @@ public class EnrollmentCollectionRepositoryMockIntegrationShould extends BaseMoc @Test public void allow_access_to_all_enrollments_without_children() { List enrollments = d2.enrollmentModule().enrollments().blockingGet(); - assertThat(enrollments.size(), is(2)); + assertThat(enrollments.size()).isEqualTo(2); Enrollment enrollment = enrollments.get(0); - assertThat(enrollment.uid(), is("enroll1")); - assertThat(enrollment.program(), is("lxAQ7Zs9VYR")); + assertThat(enrollment.uid()).isEqualTo("enroll1"); + assertThat(enrollment.program()).isEqualTo("lxAQ7Zs9VYR"); } @Test public void allow_access_to_one_enrollment_without_children() { Enrollment enrollment = d2.enrollmentModule().enrollments().uid("enroll1").blockingGet(); - assertThat(enrollment.uid(), is("enroll1")); - assertThat(enrollment.program(), is("lxAQ7Zs9VYR")); + assertThat(enrollment.uid()).isEqualTo("enroll1"); + assertThat(enrollment.program()).isEqualTo("lxAQ7Zs9VYR"); } @Test @@ -74,8 +73,8 @@ public void include_notes_as_children() { .withNotes().uid("enroll1").blockingGet(); Enrollment enrollment2 = d2.enrollmentModule().enrollments() .withNotes().uid("enroll2").blockingGet(); - assertThat(enrollment1.notes().size(), is(2)); - assertThat(enrollment2.notes().size(), is(2)); + assertThat(enrollment1.notes().size()).isEqualTo(2); + assertThat(enrollment2.notes().size()).isEqualTo(2); } @Test @@ -83,8 +82,8 @@ public void filter_by_uid() { Enrollment enrollment = d2.enrollmentModule().enrollments() .byUid().eq("enroll1") .one().blockingGet(); - assertThat(enrollment.uid(), is("enroll1")); - assertThat(enrollment.program(), is("lxAQ7Zs9VYR")); + assertThat(enrollment.uid()).isEqualTo("enroll1"); + assertThat(enrollment.program()).isEqualTo("lxAQ7Zs9VYR"); } @Test @@ -93,7 +92,7 @@ public void filter_by_created() throws ParseException { List enrollments = d2.enrollmentModule().enrollments() .byCreated().eq(created) .blockingGet(); - assertThat(enrollments.size(), is(1)); + assertThat(enrollments.size()).isEqualTo(1); } @Test @@ -102,7 +101,7 @@ public void filter_by_last_updated() throws ParseException { List enrollments = d2.enrollmentModule().enrollments() .byLastUpdated().eq(lastUpdated) .blockingGet(); - assertThat(enrollments.size(), is(1)); + assertThat(enrollments.size()).isEqualTo(1); } @Test @@ -110,7 +109,7 @@ public void filter_by_created_as_client() { List enrollments = d2.enrollmentModule().enrollments() .byCreatedAtClient().eq("2018-01-08T13:40:28.718") .blockingGet(); - assertThat(enrollments.size(), is(1)); + assertThat(enrollments.size()).isEqualTo(1); } @Test @@ -118,7 +117,7 @@ public void filter_by_last_updated_as_client() { List enrollments = d2.enrollmentModule().enrollments() .byLastUpdatedAtClient().eq("2018-01-11T13:40:28.718") .blockingGet(); - assertThat(enrollments.size(), is(1)); + assertThat(enrollments.size()).isEqualTo(1); } @Test @@ -126,7 +125,7 @@ public void filter_by_organisation_unit() { List enrollments = d2.enrollmentModule().enrollments() .byOrganisationUnit().eq("DiszpKrYNg8") .blockingGet(); - assertThat(enrollments.size(), is(2)); + assertThat(enrollments.size()).isEqualTo(2); } @Test @@ -134,7 +133,7 @@ public void filter_by_program() { List enrollments = d2.enrollmentModule().enrollments() .byProgram().eq("lxAQ7Zs9VYR") .blockingGet(); - assertThat(enrollments.size(), is(2)); + assertThat(enrollments.size()).isEqualTo(2); } @Test @@ -143,7 +142,7 @@ public void filter_by_enrollment_date() throws ParseException { List enrollments = d2.enrollmentModule().enrollments() .byEnrollmentDate().eq(created) .blockingGet(); - assertThat(enrollments.size(), is(1)); + assertThat(enrollments.size()).isEqualTo(1); } @Test @@ -152,7 +151,7 @@ public void filter_by_incident_date() throws ParseException { List enrollments = d2.enrollmentModule().enrollments() .byIncidentDate().eq(lastUpdated) .blockingGet(); - assertThat(enrollments.size(), is(1)); + assertThat(enrollments.size()).isEqualTo(1); } @Test @@ -160,7 +159,7 @@ public void filter_by_follow_up() { List enrollments = d2.enrollmentModule().enrollments() .byFollowUp().isTrue() .blockingGet(); - assertThat(enrollments.size(), is(1)); + assertThat(enrollments.size()).isEqualTo(1); } @Test @@ -168,7 +167,7 @@ public void filter_by_status() { List enrollments = d2.enrollmentModule().enrollments() .byStatus().eq(EnrollmentStatus.ACTIVE) .blockingGet(); - assertThat(enrollments.size(), is(2)); + assertThat(enrollments.size()).isEqualTo(2); } @Test @@ -176,7 +175,7 @@ public void filter_by_tracked_entity_instance() { List enrollments = d2.enrollmentModule().enrollments() .byTrackedEntityInstance().eq("nWrB0TfWlvD") .blockingGet(); - assertThat(enrollments.size(), is(1)); + assertThat(enrollments.size()).isEqualTo(1); } @Test @@ -184,7 +183,7 @@ public void filter_by_state() { List enrollments = d2.enrollmentModule().enrollments() .byState().eq(State.SYNCED) .blockingGet(); - assertThat(enrollments.size(), is(2)); + assertThat(enrollments.size()).isEqualTo(2); } @Test @@ -192,7 +191,7 @@ public void filter_by_deleted() { List enrollments = d2.enrollmentModule().enrollments() .byDeleted().isFalse() .blockingGet(); - assertThat(enrollments.size(), is(2)); + assertThat(enrollments.size()).isEqualTo(2); } @Test @@ -201,7 +200,7 @@ public void filter_by_geometry_type() { .byGeometryType().eq(FeatureType.POLYGON) .blockingGet(); - assertThat(enrollments.size(), is(1)); + assertThat(enrollments.size()).isEqualTo(1); } @Test @@ -210,7 +209,7 @@ public void filter_by_geometry_coordinates() { .byGeometryCoordinates().eq("[4.1, 2.6]") .blockingGet(); - assertThat(enrollments.size(), is(1)); + assertThat(enrollments.size()).isEqualTo(1); } @Test @@ -219,8 +218,8 @@ public void order_by_created() { .orderByCreated(RepositoryScope.OrderByDirection.DESC) .blockingGet(); - assertThat(enrollments.get(0).uid(), is("enroll1")); - assertThat(enrollments.get(1).uid(), is("enroll2")); + assertThat(enrollments.get(0).uid()).isEqualTo("enroll1"); + assertThat(enrollments.get(1).uid()).isEqualTo("enroll2"); } @Test @@ -229,8 +228,8 @@ public void order_by_created_at_client() { .orderByCreatedAtClient(RepositoryScope.OrderByDirection.DESC) .blockingGet(); - assertThat(enrollments.get(0).uid(), is("enroll2")); - assertThat(enrollments.get(1).uid(), is("enroll1")); + assertThat(enrollments.get(0).uid()).isEqualTo("enroll2"); + assertThat(enrollments.get(1).uid()).isEqualTo("enroll1"); } @Test @@ -239,8 +238,8 @@ public void order_by_last_updated() { .orderByLastUpdated(RepositoryScope.OrderByDirection.DESC) .blockingGet(); - assertThat(enrollments.get(0).uid(), is("enroll1")); - assertThat(enrollments.get(1).uid(), is("enroll2")); + assertThat(enrollments.get(0).uid()).isEqualTo("enroll1"); + assertThat(enrollments.get(1).uid()).isEqualTo("enroll2"); } @Test @@ -249,8 +248,8 @@ public void order_by_last_updated_at_client() { .orderByLastUpdatedAtClient(RepositoryScope.OrderByDirection.DESC) .blockingGet(); - assertThat(enrollments.get(0).uid(), is("enroll2")); - assertThat(enrollments.get(1).uid(), is("enroll1")); + assertThat(enrollments.get(0).uid()).isEqualTo("enroll2"); + assertThat(enrollments.get(1).uid()).isEqualTo("enroll1"); } @Test @@ -259,8 +258,8 @@ public void order_by_enrollment_date() { .orderByEnrollmentDate(RepositoryScope.OrderByDirection.DESC) .blockingGet(); - assertThat(enrollments.get(0).uid(), is("enroll1")); - assertThat(enrollments.get(1).uid(), is("enroll2")); + assertThat(enrollments.get(0).uid()).isEqualTo("enroll1"); + assertThat(enrollments.get(1).uid()).isEqualTo("enroll2"); } @Test @@ -269,23 +268,23 @@ public void order_by_incident_date() { .orderByIncidentDate(RepositoryScope.OrderByDirection.DESC) .blockingGet(); - assertThat(enrollments.get(0).uid(), is("enroll1")); - assertThat(enrollments.get(1).uid(), is("enroll2")); + assertThat(enrollments.get(0).uid()).isEqualTo("enroll1"); + assertThat(enrollments.get(1).uid()).isEqualTo("enroll2"); } @Test public void add_enrollments_to_the_repository() throws D2Error { List enrollments1 = d2.enrollmentModule().enrollments().blockingGet(); - assertThat(enrollments1.size(), is(2)); + assertThat(enrollments1.size()).isEqualTo(2); String enrolmentUid = d2.enrollmentModule().enrollments().blockingAdd(EnrollmentCreateProjection.create( "DiszpKrYNg8", "lxAQ7Zs9VYR", "nWrB0TfWlvh")); List enrollments2 = d2.enrollmentModule().enrollments().blockingGet(); - assertThat(enrollments2.size(), is(3)); + assertThat(enrollments2.size()).isEqualTo(3); Enrollment enrollment = d2.enrollmentModule().enrollments().uid(enrolmentUid).blockingGet(); - assertThat(enrollment.uid(), is(enrolmentUid)); + assertThat(enrollment.uid()).isEqualTo(enrolmentUid); d2.enrollmentModule().enrollments().uid(enrolmentUid).blockingDelete(); } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/enrollment/EnrollmentObjectRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/enrollment/EnrollmentObjectRepositoryMockIntegrationShould.java index 48d4cafdb1..2ad9e6b34f 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/enrollment/EnrollmentObjectRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/enrollment/EnrollmentObjectRepositoryMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.enrollment; @@ -34,6 +34,7 @@ import org.hisp.dhis.android.core.enrollment.EnrollmentObjectRepository; import org.hisp.dhis.android.core.enrollment.EnrollmentStatus; import org.hisp.dhis.android.core.maintenance.D2Error; +import org.hisp.dhis.android.core.maintenance.D2ErrorCode; import org.hisp.dhis.android.core.organisationunit.OrganisationUnit; import org.hisp.dhis.android.core.organisationunit.internal.OrganisationUnitStore; import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestFullDispatcher; @@ -43,10 +44,8 @@ import java.util.Date; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; -import static org.hamcrest.core.IsNull.notNullValue; -import static org.hamcrest.core.IsNull.nullValue; +import static com.google.common.truth.Truth.assertThat; +import static org.junit.Assert.fail; @RunWith(D2JunitRunner.class) public class EnrollmentObjectRepositoryMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { @@ -59,7 +58,7 @@ public void update_organisation_unit() throws D2Error { EnrollmentObjectRepository repository = objectRepository(); repository.setOrganisationUnitUid(orgUnitUid); - assertThat(repository.blockingGet().organisationUnit(), is(orgUnitUid)); + assertThat(repository.blockingGet().organisationUnit()).isEqualTo(orgUnitUid); repository.blockingDelete(); OrganisationUnitStore.create(databaseAdapter).delete(orgUnitUid); @@ -85,7 +84,7 @@ public void update_enrollment_date() throws D2Error { EnrollmentObjectRepository repository = objectRepository(); repository.setEnrollmentDate(enrollmentDate); - assertThat(repository.blockingGet().enrollmentDate(), is(enrollmentDate)); + assertThat(repository.blockingGet().enrollmentDate()).isEqualTo(enrollmentDate); repository.blockingDelete(); } @@ -97,7 +96,7 @@ public void update_incident_date() throws D2Error { EnrollmentObjectRepository repository = objectRepository(); repository.setIncidentDate(incidentDate); - assertThat(repository.blockingGet().incidentDate(), is(incidentDate)); + assertThat(repository.blockingGet().incidentDate()).isEqualTo(incidentDate); repository.blockingDelete(); } @@ -109,7 +108,7 @@ public void update_completed_date() throws D2Error { EnrollmentObjectRepository repository = objectRepository(); repository.setCompletedDate(completedDate); - assertThat(repository.blockingGet().completedDate(), is(completedDate)); + assertThat(repository.blockingGet().completedDate()).isEqualTo(completedDate); repository.blockingDelete(); } @@ -119,7 +118,7 @@ public void update_follow_up() throws D2Error { EnrollmentObjectRepository repository = objectRepository(); repository.setFollowUp(true); - assertThat(repository.blockingGet().followUp(), is(true)); + assertThat(repository.blockingGet().followUp()).isTrue(); repository.blockingDelete(); } @@ -131,8 +130,8 @@ public void update_enrollment_status_completed() throws D2Error { EnrollmentObjectRepository repository = objectRepository(); repository.setStatus(enrollmentStatus); - assertThat(repository.blockingGet().status(), is(enrollmentStatus)); - assertThat(repository.blockingGet().completedDate(), notNullValue()); + assertThat(repository.blockingGet().status()).isEqualTo(enrollmentStatus); + assertThat(repository.blockingGet().completedDate()).isNotNull(); repository.blockingDelete(); } @@ -144,8 +143,8 @@ public void update_enrollment_status_active() throws D2Error { EnrollmentObjectRepository repository = objectRepository(); repository.setStatus(enrollmentStatus); - assertThat(repository.blockingGet().status(), is(enrollmentStatus)); - assertThat(repository.blockingGet().completedDate(), nullValue()); + assertThat(repository.blockingGet().status()).isEqualTo(enrollmentStatus); + assertThat(repository.blockingGet().completedDate()).isNull(); repository.blockingDelete(); } @@ -160,11 +159,29 @@ public void update_geometry() throws D2Error { EnrollmentObjectRepository repository = objectRepository(); repository.setGeometry(geometry); - assertThat(repository.blockingGet().geometry(), is(geometry)); + assertThat(repository.blockingGet().geometry()).isEqualTo(geometry); repository.blockingDelete(); } + @Test + public void update_invalid_geometry() throws D2Error { + Geometry geometry = Geometry.builder() + .type(FeatureType.POINT) + .build(); + + EnrollmentObjectRepository repository = objectRepository(); + + try { + repository.setGeometry(geometry); + fail("Invalid geometry should fail"); + } catch (D2Error d2Error) { + assertThat(d2Error.errorCode()).isEquivalentAccordingToCompareTo(D2ErrorCode.INVALID_GEOMETRY_VALUE); + } finally { + repository.blockingDelete(); + } + } + private EnrollmentObjectRepository objectRepository() throws D2Error { String enrollmentUid = d2.enrollmentModule().enrollments().blockingAdd( EnrollmentCreateProjection.create( diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/event/EventCollectionRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/event/EventCollectionRepositoryMockIntegrationShould.java index 0eb8835058..8fc8db8b4a 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/event/EventCollectionRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/event/EventCollectionRepositoryMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.event; @@ -45,8 +45,7 @@ import java.util.Collections; import java.util.List; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) public class EventCollectionRepositoryMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { @@ -57,7 +56,7 @@ public void find_all() { d2.eventModule().events() .blockingGet(); - assertThat(events.size(), is(4)); + assertThat(events.size()).isEqualTo(4); } @Test @@ -67,7 +66,7 @@ public void filter_by_uid() { .byUid().eq("single1") .blockingGet(); - assertThat(events.size(), is(1)); + assertThat(events.size()).isEqualTo(1); } @Test @@ -77,7 +76,7 @@ public void filter_by_enrollment() { .byEnrollmentUid().eq("enroll1") .blockingGet(); - assertThat(events.size(), is(1)); + assertThat(events.size()).isEqualTo(1); } @Test @@ -87,7 +86,7 @@ public void filter_by_created() throws ParseException { .byCreated().eq(BaseNameableObject.DATE_FORMAT.parse("2017-08-07T15:47:25.959")) .blockingGet(); - assertThat(events.size(), is(1)); + assertThat(events.size()).isEqualTo(1); } @Test @@ -97,7 +96,7 @@ public void filter_by_last_updated() throws ParseException { .byLastUpdated().eq(BaseNameableObject.DATE_FORMAT.parse("2019-01-01T22:26:39.094")) .blockingGet(); - assertThat(events.size(), is(1)); + assertThat(events.size()).isEqualTo(1); } @Test @@ -107,7 +106,7 @@ public void filter_by_created_at_client() { .byCreatedAtClient().eq("2018-02-28T00:00:00.000") .blockingGet(); - assertThat(events.size(), is(0)); + assertThat(events.size()).isEqualTo(0); } @Test @@ -117,7 +116,7 @@ public void filter_by_last_updated_at_client() { .byLastUpdatedAtClient().eq("2018-02-28T00:00:00.000") .blockingGet(); - assertThat(events.size(), is(0)); + assertThat(events.size()).isEqualTo(0); } @Test @@ -127,27 +126,27 @@ public void filter_by_status() { .byStatus().eq(EventStatus.ACTIVE) .blockingGet(); - assertThat(events.size(), is(1)); + assertThat(events.size()).isEqualTo(1); } @Test public void filter_by_geometry_type() { List events = d2.eventModule().events() - .byGeometryType().eq(FeatureType.POINT) - .blockingGet(); + .byGeometryType().eq(FeatureType.POINT) + .blockingGet(); - assertThat(events.size(), is(4)); + assertThat(events.size()).isEqualTo(4); } @Test public void filter_by_geometry_coordinates() { List events = d2.eventModule().events() - .byGeometryCoordinates().eq("[21.0, 43.0]") - .blockingGet(); + .byGeometryCoordinates().eq("[21.0, 43.0]") + .blockingGet(); - assertThat(events.size(), is(1)); + assertThat(events.size()).isEqualTo(1); } @Test @@ -157,7 +156,7 @@ public void filter_by_program() { .byProgramUid().eq("lxAQ7Zs9VYR") .blockingGet(); - assertThat(events.size(), is(4)); + assertThat(events.size()).isEqualTo(4); } @Test @@ -167,7 +166,7 @@ public void filter_by_program_stage() { .byProgramStageUid().eq("dBwrot7S420") .blockingGet(); - assertThat(events.size(), is(4)); + assertThat(events.size()).isEqualTo(4); } @Test @@ -177,7 +176,7 @@ public void filter_by_organization_unit() { .byOrganisationUnitUid().eq("DiszpKrYNg8") .blockingGet(); - assertThat(events.size(), is(4)); + assertThat(events.size()).isEqualTo(4); } @Test @@ -187,7 +186,7 @@ public void filter_by_event_date() throws ParseException { .byEventDate().eq(BaseNameableObject.DATE_FORMAT.parse("2017-02-27T00:00:00.000")) .blockingGet(); - assertThat(events.size(), is(1)); + assertThat(events.size()).isEqualTo(1); } @Test @@ -197,7 +196,7 @@ public void filter_by_complete_date() throws ParseException { .byCompleteDate().eq(BaseNameableObject.DATE_FORMAT.parse("2016-02-27T00:00:00.000")) .blockingGet(); - assertThat(events.size(), is(1)); + assertThat(events.size()).isEqualTo(1); } @Test @@ -207,7 +206,7 @@ public void filter_by_due_date() throws ParseException { .byDueDate().eq(BaseNameableObject.DATE_FORMAT.parse("2017-01-28T00:00:00.000")) .blockingGet(); - assertThat(events.size(), is(1)); + assertThat(events.size()).isEqualTo(1); } @Test @@ -217,7 +216,7 @@ public void filter_by_state() { .byState().eq(State.SYNCED) .blockingGet(); - assertThat(events.size(), is(4)); + assertThat(events.size()).isEqualTo(4); } @Test @@ -227,7 +226,7 @@ public void filter_by_attribute_option_combo() { .byAttributeOptionComboUid().eq("bRowv6yZOF2") .blockingGet(); - assertThat(events.size(), is(2)); + assertThat(events.size()).isEqualTo(2); } @Test @@ -237,7 +236,7 @@ public void filter_by_deleted() { .byDeleted().isFalse() .blockingGet(); - assertThat(events.size(), is(4)); + assertThat(events.size()).isEqualTo(4); } @Test @@ -247,7 +246,27 @@ public void filter_by_tracked_entity_instance() { .byTrackedEntityInstanceUids(Collections.singletonList("nWrB0TfWlvh")) .blockingGet(); - assertThat(events.size(), is(1)); + assertThat(events.size()).isEqualTo(1); + } + + @Test + public void filter_by_data_value() { + List events = + d2.eventModule().events() + .byDataValue("hB9F8vKFmlk").lt("3843") + .blockingGet(); + + assertThat(events.size()).isEqualTo(1); + } + + @Test + public void filter_by_follow_up() { + List events = + d2.eventModule().events() + .byFollowUp(true) + .blockingGet(); + + assertThat(events.size()).isEqualTo(1); } @Test @@ -257,35 +276,35 @@ public void filter_by_assigned_user() { .byAssignedUser().eq("aTwqot2S410") .blockingGet(); - assertThat(events.size(), is(1)); + assertThat(events.size()).isEqualTo(1); } @Test public void count_tracked_entity_instances_unrestricted() { int count = d2.eventModule().events().countTrackedEntityInstances(); - assertThat(count, is(2)); + assertThat(count).isEqualTo(2); } @Test public void count_tracked_entity_instances_restricted() { int count = d2.eventModule().events().byUid().eq("event1").countTrackedEntityInstances(); - assertThat(count, is(1)); + assertThat(count).isEqualTo(1); } @Test public void include_tracked_entity_data_values_as_children() { Event event = d2.eventModule().events() .withTrackedEntityDataValues().uid("single1").blockingGet(); - assertThat(event.trackedEntityDataValues().size(), is(6)); + assertThat(event.trackedEntityDataValues().size()).isEqualTo(6); } @Test public void include_notes_as_children() { Event event = d2.eventModule().events() .withNotes().uid("single1").blockingGet(); - assertThat(event.notes().size(), is(2)); + assertThat(event.notes().size()).isEqualTo(2); } @Test @@ -293,10 +312,10 @@ public void order_by_due_date() { List events = d2.eventModule().events() .orderByDueDate(RepositoryScope.OrderByDirection.ASC) .blockingGet(); - assertThat(events.get(0).uid(), is("event1")); - assertThat(events.get(1).uid(), is("event2")); - assertThat(events.get(2).uid(), is("single1")); - assertThat(events.get(3).uid(), is("single2")); + assertThat(events.get(0).uid()).isEqualTo("event1"); + assertThat(events.get(1).uid()).isEqualTo("event2"); + assertThat(events.get(2).uid()).isEqualTo("single1"); + assertThat(events.get(3).uid()).isEqualTo("single2"); } @Test @@ -304,10 +323,10 @@ public void order_by_created() { List events = d2.eventModule().events() .orderByCreated(RepositoryScope.OrderByDirection.ASC) .blockingGet(); - assertThat(events.get(0).uid(), is("event1")); - assertThat(events.get(1).uid(), is("event2")); - assertThat(events.get(2).uid(), is("single1")); - assertThat(events.get(3).uid(), is("single2")); + assertThat(events.get(0).uid()).isEqualTo("event1"); + assertThat(events.get(1).uid()).isEqualTo("event2"); + assertThat(events.get(2).uid()).isEqualTo("single1"); + assertThat(events.get(3).uid()).isEqualTo("single2"); } @Test @@ -315,10 +334,10 @@ public void order_by_created_at_client() { List events = d2.eventModule().events() .orderByCreatedAtClient(RepositoryScope.OrderByDirection.ASC) .blockingGet(); - assertThat(events.get(0).uid(), is("event1")); - assertThat(events.get(1).uid(), is("event2")); - assertThat(events.get(2).uid(), is("single1")); - assertThat(events.get(3).uid(), is("single2")); + assertThat(events.get(0).uid()).isEqualTo("event1"); + assertThat(events.get(1).uid()).isEqualTo("event2"); + assertThat(events.get(2).uid()).isEqualTo("single1"); + assertThat(events.get(3).uid()).isEqualTo("single2"); } @Test @@ -326,10 +345,10 @@ public void order_by_last_updated() { List events = d2.eventModule().events() .orderByLastUpdated(RepositoryScope.OrderByDirection.ASC) .blockingGet(); - assertThat(events.get(0).uid(), is("event1")); - assertThat(events.get(1).uid(), is("event2")); - assertThat(events.get(2).uid(), is("single2")); - assertThat(events.get(3).uid(), is("single1")); + assertThat(events.get(0).uid()).isEqualTo("event1"); + assertThat(events.get(1).uid()).isEqualTo("event2"); + assertThat(events.get(2).uid()).isEqualTo("single2"); + assertThat(events.get(3).uid()).isEqualTo("single1"); } @Test @@ -337,10 +356,10 @@ public void order_by_last_updated_at_client() { List events = d2.eventModule().events() .orderByLastUpdatedAtClient(RepositoryScope.OrderByDirection.ASC) .blockingGet(); - assertThat(events.get(0).uid(), is("event1")); - assertThat(events.get(1).uid(), is("event2")); - assertThat(events.get(2).uid(), is("single1")); - assertThat(events.get(3).uid(), is("single2")); + assertThat(events.get(0).uid()).isEqualTo("event1"); + assertThat(events.get(1).uid()).isEqualTo("event2"); + assertThat(events.get(2).uid()).isEqualTo("single1"); + assertThat(events.get(3).uid()).isEqualTo("single2"); } @Test @@ -349,10 +368,10 @@ public void order_by_event_date_and_last_updated() { .orderByEventDate(RepositoryScope.OrderByDirection.ASC) .orderByLastUpdated(RepositoryScope.OrderByDirection.ASC) .blockingGet(); - assertThat(events.get(0).uid(), is("event2")); - assertThat(events.get(1).uid(), is("event1")); - assertThat(events.get(2).uid(), is("single2")); - assertThat(events.get(3).uid(), is("single1")); + assertThat(events.get(0).uid()).isEqualTo("event2"); + assertThat(events.get(1).uid()).isEqualTo("event1"); + assertThat(events.get(2).uid()).isEqualTo("single2"); + assertThat(events.get(3).uid()).isEqualTo("single1"); } @Test @@ -360,10 +379,10 @@ public void order_by_complete_date() { List events = d2.eventModule().events() .orderByCompleteDate(RepositoryScope.OrderByDirection.ASC) .blockingGet(); - assertThat(events.get(0).uid(), is("event2")); - assertThat(events.get(1).uid(), is("single1")); - assertThat(events.get(2).uid(), is("single2")); - assertThat(events.get(3).uid(), is("event1")); + assertThat(events.get(0).uid()).isEqualTo("event2"); + assertThat(events.get(1).uid()).isEqualTo("single1"); + assertThat(events.get(2).uid()).isEqualTo("single2"); + assertThat(events.get(3).uid()).isEqualTo("event1"); } @Test @@ -371,7 +390,7 @@ public void order_by_organisation_unit_name() { List events = d2.eventModule().events() .orderByOrganisationUnitName(RepositoryScope.OrderByDirection.ASC) .blockingGet(); - assertThat(events.size(), is(4)); + assertThat(events.size()).isEqualTo(4); } @Test @@ -379,26 +398,38 @@ public void order_by_timeline() { List events = d2.eventModule().events() .orderByTimeline(RepositoryScope.OrderByDirection.ASC) .blockingGet(); - assertThat(events.get(0).uid(), is("event1")); // eventDate - assertThat(events.get(1).uid(), is("event2")); // dueDate - assertThat(events.get(2).uid(), is("single2")); // eventDate - assertThat(events.get(3).uid(), is("single1")); // eventDate + assertThat(events.get(0).uid()).isEqualTo("event1"); // eventDate + assertThat(events.get(1).uid()).isEqualTo("event2"); // dueDate + assertThat(events.get(2).uid()).isEqualTo("single2"); // eventDate + assertThat(events.get(3).uid()).isEqualTo("single1"); // eventDate + } + + @Test + public void order_by_data_element() { + List events = d2.eventModule().events() + .byEnrollmentUid().isNull() + .orderByDataElement(RepositoryScope.OrderByDirection.DESC, "hB9F8vKFmlk") + .withTrackedEntityDataValues() + .blockingGet(); + assertThat(events.size()).isEqualTo(2); + assertThat(events.get(0).uid()).isEqualTo("single2"); // 3843 + assertThat(events.get(1).uid()).isEqualTo("single1"); // 3842 } @Test public void add_events_to_the_repository() throws D2Error { List events1 = d2.eventModule().events().blockingGet(); - assertThat(events1.size(), is(4)); + assertThat(events1.size()).isEqualTo(4); String eventUid = d2.eventModule().events().blockingAdd( EventCreateProjection.create("enroll1", "lxAQ7Zs9VYR", "dBwrot7S420", "DiszpKrYNg8", "bRowv6yZOF2")); List events2 = d2.eventModule().events().blockingGet(); - assertThat(events2.size(), is(5)); + assertThat(events2.size()).isEqualTo(5); Event event = d2.eventModule().events().uid(eventUid).blockingGet(); - assertThat(event.uid(), is(eventUid)); + assertThat(event.uid()).isEqualTo(eventUid); d2.eventModule().events().uid(eventUid).blockingDelete(); } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/event/EventFilterCollectionRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/event/EventFilterCollectionRepositoryMockIntegrationShould.java new file mode 100644 index 0000000000..72fa139cab --- /dev/null +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/event/EventFilterCollectionRepositoryMockIntegrationShould.java @@ -0,0 +1,199 @@ +/* + * Copyright (c) 2004-2021, 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.event; + +import org.hisp.dhis.android.core.common.AssignedUserMode; +import org.hisp.dhis.android.core.event.EventFilter; +import org.hisp.dhis.android.core.event.EventStatus; +import org.hisp.dhis.android.core.organisationunit.OrganisationUnitMode; +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.util.List; + +import static com.google.common.truth.Truth.assertThat; + +@RunWith(D2JunitRunner.class) +public class EventFilterCollectionRepositoryMockIntegrationShould + extends BaseMockIntegrationTestFullDispatcher { + + @Test + public void find_all() { + List eventFilters = d2.eventModule().eventFilters() + .blockingGet(); + + assertThat(eventFilters.size()).isEqualTo(2); + } + + @Test + public void filter_by_program() { + List eventFilters = d2.eventModule().eventFilters() + .byProgram().eq("lxAQ7Zs9VYR") + .blockingGet(); + + assertThat(eventFilters.size()).isEqualTo(2); + } + + @Test + public void filter_by_program_stage() { + List eventFilters = d2.eventModule().eventFilters() + .byProgramStage().eq("dBwrot7S420") + .blockingGet(); + + assertThat(eventFilters.size()).isEqualTo(2); + } + + @Test + public void filter_by_description() { + List eventFilters = d2.eventModule().eventFilters() + .byDescription().eq("Simple Filter for TB events") + .blockingGet(); + + assertThat(eventFilters.size()).isEqualTo(1); + } + + @Test + public void filter_by_follow_up() { + List eventFilters = d2.eventModule().eventFilters() + .byFollowUp().eq(Boolean.FALSE) + .blockingGet(); + + assertThat(eventFilters.size()).isEqualTo(1); + } + + @Test + public void filter_by_organisation_unit() { + List eventFilters = d2.eventModule().eventFilters() + .byOrganisationUnit().eq("DiszpKrYNg8") + .blockingGet(); + + assertThat(eventFilters.size()).isEqualTo(2); + } + + @Test + public void filter_by_ou_mode() { + List eventFilters = d2.eventModule().eventFilters() + .byOuMode().eq(OrganisationUnitMode.ACCESSIBLE) + .blockingGet(); + + assertThat(eventFilters.size()).isEqualTo(2); + } + + @Test + public void filter_by_assigned_user_mode() { + List eventFilters = d2.eventModule().eventFilters() + .byAssignedUserMode().eq(AssignedUserMode.CURRENT) + .blockingGet(); + + assertThat(eventFilters.size()).isEqualTo(1); + } + + @Test + public void filter_by_order() { + List eventFilters = d2.eventModule().eventFilters() + .byOrder().eq("dueDate:asc,createdDate:desc") + .blockingGet(); + + assertThat(eventFilters.size()).isEqualTo(2); + } + + @Test + public void filter_by_display_column_order() { + List eventFilters = d2.eventModule().eventFilters() + .byDisplayColumnOrder().like("assignedUser") + .blockingGet(); + + assertThat(eventFilters.size()).isEqualTo(2); + } + + @Test + public void filter_by_events() { + List eventFilters = d2.eventModule().eventFilters() + .byEvents().like("event2Uid") + .blockingGet(); + + assertThat(eventFilters.size()).isEqualTo(1); + } + + @Test + public void filter_by_event_status() { + List eventFilters = d2.eventModule().eventFilters() + .byEventStatus().eq(EventStatus.ACTIVE) + .blockingGet(); + + assertThat(eventFilters.size()).isEqualTo(1); + } + + @Test + public void filter_by_event_date() { + List eventFilters = d2.eventModule().eventFilters() + .byEventDate().like("2014-05-01") + .blockingGet(); + + assertThat(eventFilters.size()).isEqualTo(1); + } + + @Test + public void filter_by_due_date() { + List eventFilters = d2.eventModule().eventFilters() + .byDueDate().like("LAST_2_SIXMONTHS") + .blockingGet(); + + assertThat(eventFilters.size()).isEqualTo(1); + } + + @Test + public void filter_by_last_updated_date() { + List eventFilters = d2.eventModule().eventFilters() + .byLastUpdatedDate().like("-5") + .blockingGet(); + + assertThat(eventFilters.size()).isEqualTo(1); + } + + @Test + public void filter_by_completed_date() { + List eventFilters = d2.eventModule().eventFilters() + .byCompletedDate().like("RELATIVE") + .blockingGet(); + + assertThat(eventFilters.size()).isEqualTo(1); + } + + @Test + public void include_event_data_filters_as_children() { + EventFilter eventFilter = d2.eventModule().eventFilters() + .withEventDataFilters().one().blockingGet(); + + assertThat(eventFilter.eventQueryCriteria().dataFilters().size()).isEqualTo(4); + assertThat(eventFilter.eventQueryCriteria().dataFilters().get(0).dataItem()).isEqualTo("abcDataElementUid"); + } +} \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/event/EventObjectRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/event/EventObjectRepositoryMockIntegrationShould.java index ab4d8950b9..9bc4ffa5b8 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/event/EventObjectRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/event/EventObjectRepositoryMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.event; @@ -36,6 +36,7 @@ import org.hisp.dhis.android.core.event.EventObjectRepository; import org.hisp.dhis.android.core.event.EventStatus; import org.hisp.dhis.android.core.maintenance.D2Error; +import org.hisp.dhis.android.core.maintenance.D2ErrorCode; import org.hisp.dhis.android.core.organisationunit.OrganisationUnit; import org.hisp.dhis.android.core.organisationunit.internal.OrganisationUnitStore; import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestFullDispatcher; @@ -45,10 +46,8 @@ import java.util.Date; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; -import static org.hamcrest.core.IsNull.nullValue; -import static org.hamcrest.core.IsNull.notNullValue; +import static com.google.common.truth.Truth.assertThat; +import static org.junit.Assert.fail; @RunWith(D2JunitRunner.class) public class EventObjectRepositoryMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { @@ -61,7 +60,7 @@ public void update_organisation_unit() throws D2Error { EventObjectRepository repository = objectRepository(); repository.setOrganisationUnitUid(orgUnitUid); - assertThat(repository.blockingGet().organisationUnit(), is(orgUnitUid)); + assertThat(repository.blockingGet().organisationUnit()).isEqualTo(orgUnitUid); repository.blockingDelete(); OrganisationUnitStore.create(databaseAdapter).delete(orgUnitUid); @@ -87,7 +86,7 @@ public void update_event_date() throws D2Error { EventObjectRepository repository = objectRepository(); repository.setEventDate(eventDate); - assertThat(repository.blockingGet().eventDate(), is(eventDate)); + assertThat(repository.blockingGet().eventDate()).isEqualTo(eventDate); repository.blockingDelete(); } @@ -99,8 +98,8 @@ public void update_event_status_completed() throws D2Error { EventObjectRepository repository = objectRepository(); repository.setStatus(eventStatus); - assertThat(repository.blockingGet().status(), is(eventStatus)); - assertThat(repository.blockingGet().completedDate(), notNullValue()); + assertThat(repository.blockingGet().status()).isEqualTo(eventStatus); + assertThat(repository.blockingGet().completedDate()).isNotNull(); repository.blockingDelete(); } @@ -112,8 +111,8 @@ public void update_event_status_active() throws D2Error { EventObjectRepository repository = objectRepository(); repository.setStatus(eventStatus); - assertThat(repository.blockingGet().status(), is(eventStatus)); - assertThat(repository.blockingGet().completedDate(), nullValue()); + assertThat(repository.blockingGet().status()).isEqualTo(eventStatus); + assertThat(repository.blockingGet().completedDate()).isNull(); repository.blockingDelete(); } @@ -125,7 +124,7 @@ public void update_completed_date() throws D2Error { EventObjectRepository repository = objectRepository(); repository.setCompletedDate(completedDate); - assertThat(repository.blockingGet().completedDate(), is(completedDate)); + assertThat(repository.blockingGet().completedDate()).isEqualTo(completedDate); repository.blockingDelete(); } @@ -137,7 +136,7 @@ public void update_due_date() throws D2Error { EventObjectRepository repository = objectRepository(); repository.setDueDate(dueDate); - assertThat(repository.blockingGet().dueDate(), is(dueDate)); + assertThat(repository.blockingGet().dueDate()).isEqualTo(dueDate); repository.blockingDelete(); } @@ -152,11 +151,29 @@ public void update_geometry() throws D2Error { EventObjectRepository repository = objectRepository(); repository.setGeometry(geometry); - assertThat(repository.blockingGet().geometry(), is(geometry)); + assertThat(repository.blockingGet().geometry()).isEqualTo(geometry); repository.blockingDelete(); } + @Test + public void update_invalid_geometry() throws D2Error { + Geometry geometry = Geometry.builder() + .type(FeatureType.POINT) + .build(); + + EventObjectRepository repository = objectRepository(); + + try { + repository.setGeometry(geometry); + fail("Invalid geometry should fail"); + } catch (D2Error d2Error) { + assertThat(d2Error.errorCode()).isEquivalentAccordingToCompareTo(D2ErrorCode.INVALID_GEOMETRY_VALUE); + } finally { + repository.blockingDelete(); + } + } + @Test public void update_attribute_option_combo() throws D2Error { String attributeOptionCombo = "new_att_opt_comb"; @@ -166,7 +183,7 @@ public void update_attribute_option_combo() throws D2Error { EventObjectRepository repository = objectRepository(); repository.setAttributeOptionComboUid(attributeOptionCombo); - assertThat(repository.blockingGet().attributeOptionCombo(), is(attributeOptionCombo)); + assertThat(repository.blockingGet().attributeOptionCombo()).isEqualTo(attributeOptionCombo); repository.delete(); CategoryOptionComboStoreImpl.create(databaseAdapter).delete(attributeOptionCombo); @@ -181,7 +198,7 @@ public void not_update_attribute_option_combo_if_not_exists() throws D2Error { try { repository.setAttributeOptionComboUid(attributeOptionCombo); } finally { - repository.delete(); + repository.blockingDelete(); } } @@ -192,7 +209,7 @@ public void update_assigned_user() throws D2Error { EventObjectRepository repository = objectRepository(); repository.setAssignedUser(assignedUser); - assertThat(repository.blockingGet().assignedUser(), is(assignedUser)); + assertThat(repository.blockingGet().assignedUser()).isEqualTo(assignedUser); repository.blockingDelete(); } diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/event/search/EventQueryCollectionRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/event/search/EventQueryCollectionRepositoryMockIntegrationShould.java new file mode 100644 index 0000000000..66733bd4ff --- /dev/null +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/event/search/EventQueryCollectionRepositoryMockIntegrationShould.java @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2004-2021, 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.event.search; + +import org.hisp.dhis.android.core.event.Event; +import org.hisp.dhis.android.core.event.search.EventQueryRepositoryScope; +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.util.List; + +import static com.google.common.truth.Truth.assertThat; + +@RunWith(D2JunitRunner.class) +public class EventQueryCollectionRepositoryMockIntegrationShould + extends BaseMockIntegrationTestFullDispatcher { + + @Test + public void find_by_program() { + List events = + d2.eventModule().eventQuery() + .byProgram().eq("lxAQ7Zs9VYR") + .blockingGet(); + + assertThat(events.size()).isEqualTo(4); + } + + @Test + public void find_uids_by_program() { + List eventUids = + d2.eventModule().eventQuery() + .byProgram().eq("lxAQ7Zs9VYR") + .blockingGetUids(); + + assertThat(eventUids.size()).isEqualTo(4); + } + + @Test + public void get_scope() { + EventQueryRepositoryScope scope = + d2.eventModule().eventQuery().getScope(); + + assertThat(scope.mode()).isNotNull(); + } + + @Test + public void filter_by_event_filter() { + List event = + d2.eventModule().eventQuery() + .byEventFilter().eq("atoQ7Zs9Ijo") + .blockingGet(); + + assertThat(event.size()).isEqualTo(1); + } +} diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/fileresource/FileResourceCollectionRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/fileresource/FileResourceCollectionRepositoryMockIntegrationShould.java index 314a24eabb..9fad2b08a6 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/fileresource/FileResourceCollectionRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/fileresource/FileResourceCollectionRepositoryMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.fileresource; @@ -54,8 +54,7 @@ import java.util.Date; import java.util.List; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) public class FileResourceCollectionRepositoryMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { @@ -68,7 +67,7 @@ public void find_all() throws D2Error, IOException { d2.fileResourceModule().fileResources() .blockingGet(); - assertThat(fileResources.size(), is(1)); + assertThat(fileResources.size()).isEqualTo(1); } @Test @@ -80,7 +79,7 @@ public void filter_by_uid() throws D2Error, IOException { .byUid().eq(fileUid) .blockingGet(); - assertThat(fileResources.size(), is(1)); + assertThat(fileResources.size()).isEqualTo(1); } @Test @@ -92,7 +91,7 @@ public void filter_by_name() throws D2Error, IOException { .byName().eq(fileUid+ ".png") .blockingGet(); - assertThat(fileResources.size(), is(1)); + assertThat(fileResources.size()).isEqualTo(1); } @Test public void filter_by_last_updated() throws D2Error, IOException, ParseException { @@ -106,7 +105,7 @@ public void filter_by_last_updated() throws D2Error, IOException, ParseException .byLastUpdated().after(created) .blockingGet(); - assertThat(fileResources.size(), is(1)); + assertThat(fileResources.size()).isEqualTo(1); } @Test @@ -118,7 +117,7 @@ public void filter_by_content_type() throws D2Error, IOException { .byContentType().eq("image/png") .blockingGet(); - assertThat(fileResources.size(), is(1)); + assertThat(fileResources.size()).isEqualTo(1); } @Test @@ -130,7 +129,7 @@ public void filter_by_path() throws D2Error, IOException { .byPath().like("files/sdk_resources") .blockingGet(); - assertThat(fileResources.size(), is(1)); + assertThat(fileResources.size()).isEqualTo(1); } @Test @@ -142,7 +141,7 @@ public void filter_by_state() throws D2Error, IOException { .byState().eq(State.TO_POST) .blockingGet(); - assertThat(fileResources.size(), is(1)); + assertThat(fileResources.size()).isEqualTo(1); } @Test @@ -154,28 +153,28 @@ public void filter_by_content_length() throws D2Error, IOException { .byContentLength().eq(1024L) .blockingGet(); - assertThat(fileResources.size(), is(1)); + assertThat(fileResources.size()).isEqualTo(1); } @Test public void add_fileResources_to_the_repository() throws D2Error, IOException { cleanFileResources(); List fileResources1 = d2.fileResourceModule().fileResources().blockingGet(); - assertThat(fileResources1.size(), is(0)); + assertThat(fileResources1.size()).isEqualTo(0); File file = getFile(); - assertThat(file.exists(), is(true)); + assertThat(file.exists()).isTrue(); String fileResourceUid = d2.fileResourceModule().fileResources().blockingAdd(file); List fileResources2 = d2.fileResourceModule().fileResources().blockingGet(); - assertThat(fileResources2.size(), is(1)); + assertThat(fileResources2.size()).isEqualTo(1); FileResource fileResource = d2.fileResourceModule().fileResources().uid(fileResourceUid).blockingGet(); - assertThat(fileResource.uid(), is(fileResourceUid)); + assertThat(fileResource.uid()).isEqualTo(fileResourceUid); File savedFile = new File(fileResource.path()); - assertThat(savedFile.exists(), is(true)); + assertThat(savedFile.exists()).isTrue(); } private File getFile() { diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/imports/TrackerImportConflictCollectionRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/imports/TrackerImportConflictCollectionRepositoryMockIntegrationShould.java index f202ea5917..228de14c31 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/imports/TrackerImportConflictCollectionRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/imports/TrackerImportConflictCollectionRepositoryMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.imports; @@ -39,8 +39,7 @@ import java.text.ParseException; import java.util.List; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) public class TrackerImportConflictCollectionRepositoryMockIntegrationShould @@ -49,69 +48,69 @@ public class TrackerImportConflictCollectionRepositoryMockIntegrationShould @Test public void find_all() { List trackerImportConflicts = d2.importModule().trackerImportConflicts().blockingGet(); - assertThat(trackerImportConflicts.size(), is(2)); + assertThat(trackerImportConflicts.size()).isEqualTo(2); } @Test public void filter_by_conflict() { List trackerImportConflicts = d2.importModule().trackerImportConflicts() .byConflict().eq("conflict").blockingGet(); - assertThat(trackerImportConflicts.size(), is(1)); + assertThat(trackerImportConflicts.size()).isEqualTo(1); } @Test public void filter_by_value() { List trackerImportConflicts = d2.importModule().trackerImportConflicts() .byValue().eq("value").blockingGet(); - assertThat(trackerImportConflicts.size(), is(1)); + assertThat(trackerImportConflicts.size()).isEqualTo(1); } @Test public void filter_by_tracked_entity_instance() { List trackerImportConflicts = d2.importModule().trackerImportConflicts() .byTrackedEntityInstanceUid().eq("nWrB0TfWlvh").blockingGet(); - assertThat(trackerImportConflicts.size(), is(1)); + assertThat(trackerImportConflicts.size()).isEqualTo(1); } @Test public void filter_by_enrollment() { List trackerImportConflicts = d2.importModule().trackerImportConflicts() .byEnrollmentUid().eq("enroll2").blockingGet(); - assertThat(trackerImportConflicts.size(), is(1)); + assertThat(trackerImportConflicts.size()).isEqualTo(1); } @Test public void filter_by_event() { List trackerImportConflicts = d2.importModule().trackerImportConflicts() .byEventUid().eq("event2").blockingGet(); - assertThat(trackerImportConflicts.size(), is(1)); + assertThat(trackerImportConflicts.size()).isEqualTo(1); } @Test public void filter_by_tale_reference() { List trackerImportConflicts = d2.importModule().trackerImportConflicts() .byTableReference().eq("table_reference").blockingGet(); - assertThat(trackerImportConflicts.size(), is(1)); + assertThat(trackerImportConflicts.size()).isEqualTo(1); } @Test public void filter_by_error_code() { List trackerImportConflicts = d2.importModule().trackerImportConflicts() .byErrorCode().eq("error_code").blockingGet(); - assertThat(trackerImportConflicts.size(), is(1)); + assertThat(trackerImportConflicts.size()).isEqualTo(1); } @Test public void filter_by_status() { List trackerImportConflicts = d2.importModule().trackerImportConflicts() .byStatus().eq(ImportStatus.SUCCESS).blockingGet(); - assertThat(trackerImportConflicts.size(), is(1)); + assertThat(trackerImportConflicts.size()).isEqualTo(1); } @Test public void filter_by_created() throws ParseException { List trackerImportConflicts = d2.importModule().trackerImportConflicts() .byCreated().eq(BaseIdentifiableObject.parseDate("2017-11-29T11:27:46.935")).blockingGet(); - assertThat(trackerImportConflicts.size(), is(2)); + assertThat(trackerImportConflicts.size()).isEqualTo(2); } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/indicator/IndicatorCollectionRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/indicator/IndicatorCollectionRepositoryMockIntegrationShould.java index 87200d3a39..41eb50e990 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/indicator/IndicatorCollectionRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/indicator/IndicatorCollectionRepositoryMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.indicator; @@ -36,8 +36,7 @@ import java.util.List; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) public class IndicatorCollectionRepositoryMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { @@ -46,7 +45,7 @@ public class IndicatorCollectionRepositoryMockIntegrationShould extends BaseMock public void find_all() { List indicators = d2.indicatorModule().indicators() .blockingGet(); - assertThat(indicators.size(), is(1)); + assertThat(indicators.size()).isEqualTo(1); } @Test @@ -54,7 +53,7 @@ public void filter_by_annualized() { List indicators = d2.indicatorModule().indicators() .byAnnualized().isFalse() .blockingGet(); - assertThat(indicators.size(), is(1)); + assertThat(indicators.size()).isEqualTo(1); } @Test @@ -62,7 +61,7 @@ public void filter_by_indicator_type_url() { List indicators = d2.indicatorModule().indicators() .byIndicatorTypeUid().eq("bWuNrMHEoZ0") .blockingGet(); - assertThat(indicators.size(), is(1)); + assertThat(indicators.size()).isEqualTo(1); } @Test @@ -70,7 +69,7 @@ public void filter_by_numerator() { List indicators = d2.indicatorModule().indicators() .byNumerator().eq("#{fbfJHSPpUQD.pq2XI5kz2BY}+#{fbfJHSPpUQD.PT59n8BQbqM}-#{Jtf34kNZhzP.pq2XI5kz2BY}-#{Jtf34kNZhzP.PT59n8BQbqM}") .blockingGet(); - assertThat(indicators.size(), is(1)); + assertThat(indicators.size()).isEqualTo(1); } @Test @@ -78,7 +77,7 @@ public void filter_by_numerator_description() { List indicators = d2.indicatorModule().indicators() .byNumeratorDescription().eq("ANC1-ANC3") .blockingGet(); - assertThat(indicators.size(), is(1)); + assertThat(indicators.size()).isEqualTo(1); } @Test @@ -86,7 +85,7 @@ public void filter_by_denominator() { List indicators = d2.indicatorModule().indicators() .byDenominator().eq("#{fbfJHSPpUQD.pq2XI5kz2BY}+#{fbfJHSPpUQD.PT59n8BQbqM}") .blockingGet(); - assertThat(indicators.size(), is(1)); + assertThat(indicators.size()).isEqualTo(1); } @Test @@ -94,7 +93,7 @@ public void filter_by_denominator_description() { List indicators = d2.indicatorModule().indicators() .byDenominatorDescription().eq("Total 1st ANC visits") .blockingGet(); - assertThat(indicators.size(), is(1)); + assertThat(indicators.size()).isEqualTo(1); } @Test @@ -102,6 +101,22 @@ public void filter_by_url() { List indicators = d2.indicatorModule().indicators() .byUrl().eq("url") .blockingGet(); - assertThat(indicators.size(), is(1)); + assertThat(indicators.size()).isEqualTo(1); + } + + @Test + public void filter_by_dataSetUid() { + List indicators = d2.indicatorModule().indicators() + .byDataSetUid("lyLU2wR22tC") + .blockingGet(); + assertThat(indicators.size()).isEqualTo(1); + } + + @Test + public void filter_by_sectionUid() { + List indicators = d2.indicatorModule().indicators() + .bySectionUid("Y2rk0vzgvAx") + .blockingGet(); + assertThat(indicators.size()).isEqualTo(1); } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/indicator/IndicatorTypeCollectionRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/indicator/IndicatorTypeCollectionRepositoryMockIntegrationShould.java index a8029cd56b..edf9f3961b 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/indicator/IndicatorTypeCollectionRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/indicator/IndicatorTypeCollectionRepositoryMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.indicator; @@ -36,8 +36,7 @@ import java.util.List; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) public class IndicatorTypeCollectionRepositoryMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { @@ -46,7 +45,7 @@ public class IndicatorTypeCollectionRepositoryMockIntegrationShould extends Base public void find_all() { List indicatorTypes = d2.indicatorModule().indicatorTypes() .blockingGet(); - assertThat(indicatorTypes.size(), is(1)); + assertThat(indicatorTypes.size()).isEqualTo(1); } @Test @@ -54,7 +53,7 @@ public void filter_by_number() { List indicatorTypes = d2.indicatorModule().indicatorTypes() .byNumber().isFalse() .blockingGet(); - assertThat(indicatorTypes.size(), is(1)); + assertThat(indicatorTypes.size()).isEqualTo(1); } @Test @@ -62,6 +61,6 @@ public void filter_by_factor() { List indicatorTypes = d2.indicatorModule().indicatorTypes() .byFactor().eq(100) .blockingGet(); - assertThat(indicatorTypes.size(), is(1)); + assertThat(indicatorTypes.size()).isEqualTo(1); } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/legendset/LegendCollectionRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/legendset/LegendCollectionRepositoryMockIntegrationShould.java index 19a3a07256..081a7324cc 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/legendset/LegendCollectionRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/legendset/LegendCollectionRepositoryMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.legendset; @@ -36,8 +36,7 @@ import java.util.List; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) public class LegendCollectionRepositoryMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { @@ -46,7 +45,7 @@ public class LegendCollectionRepositoryMockIntegrationShould extends BaseMockInt public void find_all() { List legends = d2.legendSetModule().legends() .blockingGet(); - assertThat(legends.size(), is(2)); + assertThat(legends.size()).isEqualTo(4); } @Test @@ -54,7 +53,7 @@ public void find_by_start_value() { List legends = d2.legendSetModule().legends() .byStartValue().eq(15.0) .blockingGet(); - assertThat(legends.size(), is(1)); + assertThat(legends.size()).isEqualTo(1); } @Test @@ -62,7 +61,7 @@ public void find_by_end_value() { List legends = d2.legendSetModule().legends() .byEndValue().eq(30.0) .blockingGet(); - assertThat(legends.size(), is(1)); + assertThat(legends.size()).isEqualTo(1); } @Test @@ -71,7 +70,7 @@ public void find_by_value_between() { .byStartValue().smallerThan(20.0) .byEndValue().biggerThan(20.0) .blockingGet(); - assertThat(legends.size(), is(1)); + assertThat(legends.size()).isEqualTo(2); } @Test @@ -79,7 +78,7 @@ public void find_by_color() { List legends = d2.legendSetModule().legends() .byColor().eq("#E6AE5E") .blockingGet(); - assertThat(legends.size(), is(1)); + assertThat(legends.size()).isEqualTo(1); } @Test @@ -87,6 +86,6 @@ public void find_by_legend_set() { List legends = d2.legendSetModule().legends() .byLegendSet().eq("TiOkbpGEud4") .blockingGet(); - assertThat(legends.size(), is(2)); + assertThat(legends.size()).isEqualTo(2); } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/legendset/LegendSetCollectionRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/legendset/LegendSetCollectionRepositoryMockIntegrationShould.java index b2312e7376..3cfdf36609 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/legendset/LegendSetCollectionRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/legendset/LegendSetCollectionRepositoryMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.legendset; @@ -36,8 +36,7 @@ import java.util.List; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) public class LegendSetCollectionRepositoryMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { @@ -46,7 +45,7 @@ public class LegendSetCollectionRepositoryMockIntegrationShould extends BaseMock public void find_all() { List legendSets = d2.legendSetModule().legendSets() .blockingGet(); - assertThat(legendSets.size(), is(1)); + assertThat(legendSets.size()).isEqualTo(2); } @Test @@ -54,7 +53,7 @@ public void filter_by_symbolizer() { List legendSets = d2.legendSetModule().legendSets() .bySymbolizer().eq("color") .blockingGet(); - assertThat(legendSets.size(), is(1)); + assertThat(legendSets.size()).isEqualTo(2); } @Test @@ -63,6 +62,6 @@ public void include_legends_as_children() { .withLegends() .one() .blockingGet(); - assertThat(legendSet.legends().size(), is(2)); + assertThat(legendSet.legends().size()).isEqualTo(2); } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/maintenance/D2ErrorCollectionRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/maintenance/D2ErrorCollectionRepositoryMockIntegrationShould.java index e34d3434cb..b7a8bac574 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/maintenance/D2ErrorCollectionRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/maintenance/D2ErrorCollectionRepositoryMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.maintenance; @@ -44,8 +44,7 @@ import java.util.Date; import java.util.List; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) public class D2ErrorCollectionRepositoryMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { @@ -54,35 +53,35 @@ public class D2ErrorCollectionRepositoryMockIntegrationShould extends BaseMockIn public void filter_d2_error_by_url() { List d2Errors = d2.maintenanceModule().d2Errors() .byUrl().like("http://dhis2.org/api/programs/uid").blockingGet(); - assertThat(d2Errors.size(), is(1)); + assertThat(d2Errors.size()).isEqualTo(1); } @Test public void filter_d2_error_by_d2_error_code() { List d2Errors = d2.maintenanceModule().d2Errors() .byD2ErrorCode().eq(D2ErrorCode.BAD_CREDENTIALS).blockingGet(); - assertThat(d2Errors.size(), is(1)); + assertThat(d2Errors.size()).isEqualTo(1); } @Test public void filter_d2_error_by_d2_error_component() { List d2Errors = d2.maintenanceModule().d2Errors() .byD2ErrorComponent().eq(D2ErrorComponent.Server).blockingGet(); - assertThat(d2Errors.size(), is(1)); + assertThat(d2Errors.size()).isEqualTo(1); } @Test public void filter_d2_error_by_error_description() { List d2Errors = d2.maintenanceModule().d2Errors() .byErrorDescription().eq("Error processing response").blockingGet(); - assertThat(d2Errors.size(), is(1)); + assertThat(d2Errors.size()).isEqualTo(1); } @Test public void filter_d2_error_by_http_error_code() { List d2Errors = d2.maintenanceModule().d2Errors() .byHttpErrorCode().eq(402).blockingGet(); - assertThat(d2Errors.size(), is(1)); + assertThat(d2Errors.size()).isEqualTo(1); } @Test @@ -105,6 +104,6 @@ public void filter_d2_error_by_created() { .build(); List d2Errors = d2.maintenanceModule().d2Errors() .byCreated().inPeriods(Lists.newArrayList(todayPeriod)).blockingGet(); - assertThat(d2Errors.size(), is(2)); + assertThat(d2Errors.size()).isEqualTo(2); } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/maintenance/ForeignKeyViolationCollectionRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/maintenance/ForeignKeyViolationCollectionRepositoryMockIntegrationShould.java index 53ffa2e5c6..d22a63715b 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/maintenance/ForeignKeyViolationCollectionRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/maintenance/ForeignKeyViolationCollectionRepositoryMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.maintenance; @@ -38,8 +38,7 @@ import java.text.ParseException; import java.util.List; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) public class ForeignKeyViolationCollectionRepositoryMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { @@ -47,62 +46,62 @@ public class ForeignKeyViolationCollectionRepositoryMockIntegrationShould extend @Test public void find_all() { List foreignKeyViolations = d2.maintenanceModule().foreignKeyViolations().blockingGet(); - assertThat(foreignKeyViolations.size(), is(3)); + assertThat(foreignKeyViolations.size()).isEqualTo(3); } @Test public void filter_by_from_table() { List foreignKeyViolations = d2.maintenanceModule().foreignKeyViolations() .byFromTable().eq("CategoryOptionComboCategoryOptionLink").blockingGet(); - assertThat(foreignKeyViolations.size(), is(1)); + assertThat(foreignKeyViolations.size()).isEqualTo(1); } @Test public void filter_by_from_column() { List foreignKeyViolations = d2.maintenanceModule().foreignKeyViolations() .byFromColumn().eq("categoryOption").blockingGet(); - assertThat(foreignKeyViolations.size(), is(1)); + assertThat(foreignKeyViolations.size()).isEqualTo(1); } @Test public void filter_by_to_table() { List foreignKeyViolations = d2.maintenanceModule().foreignKeyViolations() .byToTable().eq("CategoryOption").blockingGet(); - assertThat(foreignKeyViolations.size(), is(1)); + assertThat(foreignKeyViolations.size()).isEqualTo(1); } @Test public void filter_by_to_column() { List foreignKeyViolations = d2.maintenanceModule().foreignKeyViolations() .byToColumn().eq("uid").blockingGet(); - assertThat(foreignKeyViolations.size(), is(2)); + assertThat(foreignKeyViolations.size()).isEqualTo(2); } @Test public void filter_by_not_found_value() { List foreignKeyViolations = d2.maintenanceModule().foreignKeyViolations() .byNotFoundValue().eq("non_existent_category_option_uid").blockingGet(); - assertThat(foreignKeyViolations.size(), is(1)); + assertThat(foreignKeyViolations.size()).isEqualTo(1); } @Test public void filter_by_from_object_uid() { List foreignKeyViolations = d2.maintenanceModule().foreignKeyViolations() .byFromObjectUid().eq("non_existent_option_uid").blockingGet(); - assertThat(foreignKeyViolations.size(), is(1)); + assertThat(foreignKeyViolations.size()).isEqualTo(1); } @Test public void filter_by_from_object_row() { List foreignKeyViolations = d2.maintenanceModule().foreignKeyViolations() .byFromObjectRow().like("categoryOption: non_existent_category_option_uid").blockingGet(); - assertThat(foreignKeyViolations.size(), is(1)); + assertThat(foreignKeyViolations.size()).isEqualTo(1); } @Test public void filter_by_created() throws ParseException { List foreignKeyViolations = d2.maintenanceModule().foreignKeyViolations() .byCreated().after(BaseIdentifiableObject.parseDate("2019-01-15T08:14:06.767")).blockingGet(); - assertThat(foreignKeyViolations.size(), is(3)); + assertThat(foreignKeyViolations.size()).isEqualTo(3); } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/maintenance/MaintenanceMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/maintenance/MaintenanceMockIntegrationShould.java index 36a4ba2bee..7fbeeb88fe 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/maintenance/MaintenanceMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/maintenance/MaintenanceMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.maintenance; @@ -43,8 +43,7 @@ import java.util.ArrayList; import java.util.List; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) public class MaintenanceMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { @@ -52,7 +51,7 @@ public class MaintenanceMockIntegrationShould extends BaseMockIntegrationTestFul @Test public void allow_access_to_foreign_key_violations() { List violations = d2.maintenanceModule().foreignKeyViolations().blockingGet(); - assertThat(violations.size(), is(3)); + assertThat(violations.size()).isEqualTo(3); ForeignKeyViolation categoryOptionComboViolation = ForeignKeyViolation.builder() .toTable(CategoryOptionTableInfo.TABLE_INFO.name()) @@ -76,25 +75,25 @@ public void allow_access_to_foreign_key_violations() { violationsToCompare.add(violation.toBuilder().id(null).created(null).fromObjectRow(null).build()); } - assertThat(violationsToCompare.contains(categoryOptionComboViolation), is(true)); - assertThat(violationsToCompare.contains(optionViolation), is(true)); + assertThat(violationsToCompare.contains(categoryOptionComboViolation)).isTrue(); + assertThat(violationsToCompare.contains(optionViolation)).isTrue(); } @Test public void get_no_vulnerabilities_for_high_threshold() { assertThat(d2.maintenanceModule().getPerformanceHintsService(100, - 100).areThereVulnerabilities(), is(false)); + 100).areThereVulnerabilities()).isFalse(); } @Test public void get_vulnerabilities_for_low_threshold() { assertThat(d2.maintenanceModule().getPerformanceHintsService(1, - 1).areThereVulnerabilities(), is(true)); + 1).areThereVulnerabilities()).isTrue(); } @Test public void allow_access_to_d2_errors() { List d2Errors = d2.maintenanceModule().d2Errors().blockingGet(); - assertThat(d2Errors.size(), is(2)); + assertThat(d2Errors.size()).isEqualTo(2); } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/note/NoteCollectionRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/note/NoteCollectionRepositoryMockIntegrationShould.java index 7897f0dbd7..e72e532342 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/note/NoteCollectionRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/note/NoteCollectionRepositoryMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.note; @@ -36,8 +36,7 @@ import java.util.List; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) public class NoteCollectionRepositoryMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { @@ -45,53 +44,53 @@ public class NoteCollectionRepositoryMockIntegrationShould extends BaseMockInteg @Test public void find_all() { List notes = d2.noteModule().notes().blockingGet(); - assertThat(notes.size(), is(10)); + assertThat(notes.size()).isEqualTo(10); } @Test public void filter_by_uid() { List notes = d2.noteModule().notes().byUid().eq("enrollmentNote1").blockingGet(); - assertThat(notes.size(), is(1)); + assertThat(notes.size()).isEqualTo(1); } @Test public void filter_by_note_type() { List enrollmentNotes = d2.noteModule().notes() .byNoteType().eq(Note.NoteType.ENROLLMENT_NOTE).blockingGet(); - assertThat(enrollmentNotes.size(), is(4)); + assertThat(enrollmentNotes.size()).isEqualTo(4); List eventNotes = d2.noteModule().notes() .byNoteType().eq(Note.NoteType.EVENT_NOTE).blockingGet(); - assertThat(eventNotes.size(), is(6)); + assertThat(eventNotes.size()).isEqualTo(6); } @Test public void filter_by_event_uid() { List notes = d2.noteModule().notes().byEventUid().eq("event1").blockingGet(); - assertThat(notes.size(), is(2)); + assertThat(notes.size()).isEqualTo(2); } @Test public void filter_by_enrollment_uid() { List notes = d2.noteModule().notes().byEnrollmentUid().eq("enroll1").blockingGet(); - assertThat(notes.size(), is(2)); + assertThat(notes.size()).isEqualTo(2); } @Test public void filter_by_value() { List notes = d2.noteModule().notes().byValue().eq("TEI enrollment note 3").blockingGet(); - assertThat(notes.size(), is(1)); + assertThat(notes.size()).isEqualTo(1); } @Test public void filter_by_stored_by() { List notes = d2.noteModule().notes().byStoredBy().eq("android").blockingGet(); - assertThat(notes.size(), is(10)); + assertThat(notes.size()).isEqualTo(10); } @Test public void filter_by_stored_date() { List notes = d2.noteModule().notes().byStoredDate().eq("2018-03-19T15:20:55.058").blockingGet(); - assertThat(notes.size(), is(8)); + assertThat(notes.size()).isEqualTo(8); } } \ No newline at end of file diff --git a/core/src/androidTest/java/org/hisp/dhis/android/testapp/option/OptionCollectionRepositoryMockIntegrationShould.java b/core/src/androidTest/java/org/hisp/dhis/android/testapp/option/OptionCollectionRepositoryMockIntegrationShould.java index de41fc244b..9424983b2e 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/testapp/option/OptionCollectionRepositoryMockIntegrationShould.java +++ b/core/src/androidTest/java/org/hisp/dhis/android/testapp/option/OptionCollectionRepositoryMockIntegrationShould.java @@ -1,29 +1,29 @@ /* - * Copyright (c) 2004-2019, University of Oslo - * All rights reserved. + * Copyright (c) 2004-2021, 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. + * 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. + * 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. + * 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.option; @@ -37,8 +37,7 @@ import java.util.List; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; +import static com.google.common.truth.Truth.assertThat; @RunWith(D2JunitRunner.class) public class OptionCollectionRepositoryMockIntegrationShould extends BaseMockIntegrationTestFullDispatcher { @@ -46,22 +45,22 @@ public class OptionCollectionRepositoryMockIntegrationShould extends BaseMockInt @Test public void find_all() { List