Skip to content

Commit

Permalink
Merge pull request #101 from infinum/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
bojankoma authored Dec 24, 2021
2 parents 8d2d695 + cb895c4 commit d5b0aa4
Show file tree
Hide file tree
Showing 178 changed files with 2,916 additions and 2,014 deletions.
9 changes: 0 additions & 9 deletions .codecov.yml

This file was deleted.

9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
Changelog
=========

## Version 5.4.2

_2021-12-24_

* Update to Kotlin 1.6.10.
* Update Corooutines to 1.6.0.
* Update Gradle wrapper to 7.3.3.
* Refactor edit database activity to rename database dialog.

## Version 5.4.1

_2021-09-25_
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ Then add the following dependencies in your app `build.gradle` or `build.gradle.

**Groovy**
```groovy
debugImplementation "com.infinum.dbinspector:dbinspector:5.4.1"
releaseImplementation "com.infinum.dbinspector:dbinspector-no-op:5.4.1"
debugImplementation "com.infinum.dbinspector:dbinspector:5.4.2"
releaseImplementation "com.infinum.dbinspector:dbinspector-no-op:5.4.2"
```
**KotlinDSL**
```kotlin
debugImplementation("com.infinum.dbinspector:dbinspector:5.4.1")
releaseImplementation("com.infinum.dbinspector:dbinspector-no-op:5.4.1")
debugImplementation("com.infinum.dbinspector:dbinspector:5.4.2")
releaseImplementation("com.infinum.dbinspector:dbinspector-no-op:5.4.2")
```

### Usage
Expand Down
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ buildscript {
classpath libs.ktlint
classpath libs.dokka
classpath libs.protobuf.gradle
classpath libs.kover
}
}

Expand Down
4 changes: 2 additions & 2 deletions config.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ext {
]
releaseConfig = [
"group" : "com.infinum.dbinspector",
"version" : "5.4.1",
"versionCode": 5 * 100 * 100 + 4 * 100 + 1
"version" : "5.4.2",
"versionCode": 5 * 100 * 100 + 4 * 100 + 2
]
}
159 changes: 39 additions & 120 deletions dbinspector/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.gradle.api.tasks.testing.TestListener
import org.gradle.api.tasks.testing.TestResult.ResultType
import groovy.time.TimeCategory
import groovy.time.TimeDuration

plugins {
id "com.android.library"
id "kotlin-android"
id "kotlin-parcelize"
id "com.google.protobuf"
id "kover"
}

android {
Expand Down Expand Up @@ -56,6 +51,36 @@ android {

testOptions {
unitTests.returnDefaultValues = true
unitTests.all {
kover {
enabled = name == "testDebugUnitTest"
includes = [
"com.infinum.dbinspector.data.sources.*",
"com.infinum.dbinspector.domain.*.*UseCase*.*",
"com.infinum.dbinspector.domain.*.*Repository*.*",
"com.infinum.dbinspector.domain.*.*Control*.*",
"com.infinum.dbinspector.domain.*.*Converter*.*",
"com.infinum.dbinspector.domain.*.*Mapper*.*",
"com.infinum.dbinspector.domain.*.*Interactor*.*",
"com.infinum.dbinspector.ui.*.*ViewModel*.*"
]
excludes = [
"com.infinum.dbinspector.di.*",
"com.infinum.dbinspector.data.shared.base.*",
"com.infinum.dbinspector.domain.schema.shared.models.*",
"com.infinum.dbinspector.domain.shared.base.*",
"com.infinum.dbinspector.domain.shared.models.dsl.*",
"com.infinum.dbinspector.ui.shared.base.*",
"com.infinum.dbinspector.ui.shared.delegates.*",
"com.infinum.dbinspector.ui.shared.edgefactories.*",
"com.infinum.dbinspector.ui.shared.listeners.*",
"com.infinum.dbinspector.ui.shared.searchable.*",
"com.infinum.dbinspector.ui.shared.views.*",
"com.infinum.dbinspector.extensions.*",
"com.infinum.dbinspector.databinding.*"
]
}
}
}

sourceSets.each {
Expand Down Expand Up @@ -97,122 +122,16 @@ protobuf {
}
}

kover {
enabled = true
coverageEngine.set(kotlinx.kover.api.CoverageEngine.INTELLIJ)
intellijEngineVersion.set(libs.versions.intellij.get())
jacocoEngineVersion.set(libs.versions.jacoco.get())
generateReportOnCheck.set(true)
}

tasks.withType(Test) {
useJUnitPlatform()
// testLogging {
// events TestLogEvent.FAILED, TestLogEvent.SKIPPED // , TestLogEvent.PASSED
// }
def testListener = new TestListener() {

def template = """
# {timestamp}
## Duration
{duration}
## Count
| Total | Passed | Failed | Failed |
|:-------------:|:--------------:|:--------------:|:---------------:|
| {total_count} | {passed_count} | {failed_count} | {skipped_count} |
## Details
<details>
<summary>PASSED</summary>
{passed}
</details>
<details>
<summary>FAILED</summary>
{failed}
</details>
<details>
<summary>SKIPPED</summary>
{skipped}
</details>
"""
ArrayList<TestDescriptor> passed = new ArrayList<TestDescriptor>()
ArrayList<TestDescriptor> failed = new ArrayList<TestDescriptor>()
ArrayList<TestDescriptor> skipped = new ArrayList<TestDescriptor>()

@Override
void beforeSuite(TestDescriptor testDescriptor) {

}

@Override
void afterSuite(TestDescriptor testDescriptor, TestResult testResult) {
if (testDescriptor.getParent() == null) {
TimeDuration duration = TimeCategory.minus(new Date(testResult.endTime), new Date(testResult.startTime))

def passedSuite = ""
Map<TestDescriptor, List<TestDescriptor>> passedMap = passed.groupBy { it.parent }
passedMap.each {
passedSuite += " * " + it.key.displayName
passedSuite += "\n"
it.value.each {
passedSuite += " * " + it.displayName
passedSuite += "\n"
}
}
def failedSuite = ""
Map<TestDescriptor, List<TestDescriptor>> failedMap = failed.groupBy { it.parent }
failedMap.each {
failedSuite += " * " + it.key.displayName
failedSuite += "\n"
it.value.each {
failedSuite += " * " + it.displayName
failedSuite += "\n"
}
}
def skippedSuite = ""
Map<TestDescriptor, List<TestDescriptor>> skippedMap = skipped.groupBy { it.parent }
skippedMap.each {
skippedSuite += " * " + it.key.displayName
skippedSuite += "\n"
it.value.each {
skippedSuite += " * " + it.displayName
skippedSuite += "\n"
}
}

File file = new File("test_report.md")
file << template
.replace("{timestamp}", new Date().format("dd.MM.yyyy. - HH:mm"))
.replace("{duration}", duration.toString())
.replace("{total_count}", testResult.testCount + "")
.replace("{passed_count}", testResult.successfulTestCount + "")
.replace("{failed_count}", testResult.failedTestCount + "")
.replace("{skipped_count}", testResult.skippedTestCount + "")
.replace("{passed}", passedSuite)
.replace("{failed}", failedSuite)
.replace("{skipped}", skippedSuite)
}
}

@Override
void beforeTest(TestDescriptor testDescriptor) {

}

@Override
void afterTest(TestDescriptor testDescriptor, TestResult testResult) {
// println('\n\nNAME: ' + testDescriptor.name + '\nDISPLAY NAME: ' + testDescriptor.displayName + '\nCLASS NAME: ' + testDescriptor.className + '\nIS COMPOSITE: ' + testDescriptor.isComposite() + '\nPARENT: ' + testDescriptor.parent + '\nRESULT: ' + testResult.resultType)
if (testResult.resultType == ResultType.FAILURE || testResult.resultType == ResultType.SKIPPED) {
println('\n\nNAME: ' + testDescriptor.name + '\nDISPLAY NAME: ' + testDescriptor.displayName + '\nCLASS NAME: ' + testDescriptor.className + '\nIS COMPOSITE: ' + testDescriptor.isComposite() + '\nPARENT: ' + testDescriptor.parent + '\nRESULT: ' + testResult.resultType)
}
if (testResult.resultType == ResultType.FAILURE) {
failed += testDescriptor
} else if (testResult.resultType == ResultType.SKIPPED) {
skipped += testDescriptor
} else if (testResult.resultType == ResultType.SUCCESS) {
passed += testDescriptor
}
}
}
addTestListener(testListener)
finalizedBy jacocoTestReport
}

apply from: "jacoco.gradle"
apply from: "publish.gradle"
87 changes: 0 additions & 87 deletions dbinspector/jacoco.gradle

This file was deleted.

6 changes: 0 additions & 6 deletions dbinspector/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@
android:taskAffinity="com.infinum.dbinspector"
android:theme="@style/DbInspector.BaseTheme" />

<activity
android:name="com.infinum.dbinspector.ui.databases.edit.EditDatabaseActivity"
android:exported="false"
android:taskAffinity="com.infinum.dbinspector"
android:theme="@style/DbInspector.BaseTheme" />

<activity
android:name="com.infinum.dbinspector.ui.schema.SchemaActivity"
android:exported="false"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ internal object Data {
get(qualifier = Qualifiers.Schema.TRIGGERS),
get(qualifier = Qualifiers.Schema.TRIGGER_BY_NAME),
get(qualifier = Qualifiers.Schema.DROP_TRIGGER),
get(),
get()
)
}
Expand All @@ -155,15 +154,13 @@ internal object Data {
get(qualifier = Qualifiers.Pragma.TABLE_INFO),
get(qualifier = Qualifiers.Pragma.FOREIGN_KEYS),
get(qualifier = Qualifiers.Pragma.INDEXES),
get(),
get()
)
}

factory<Sources.Local.RawQuery> {
RawQuerySource(
get(qualifier = Qualifiers.Schema.RAW_QUERY),
get(),
get()
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import com.infinum.dbinspector.data.models.local.cursor.output.FieldType
import com.infinum.dbinspector.data.models.local.cursor.output.QueryResult
import com.infinum.dbinspector.data.models.local.cursor.output.Row
import com.infinum.dbinspector.data.sources.local.cursor.shared.CursorSource
import com.infinum.dbinspector.data.sources.memory.logger.Logger
import com.infinum.dbinspector.data.sources.memory.pagination.Paginator
import kotlin.coroutines.resume
import kotlin.coroutines.resumeWithException
Expand All @@ -19,9 +18,8 @@ internal class PragmaSource(
private val tableInfoPaginator: Paginator,
private val foreignKeysPaginator: Paginator,
private val indexesPaginator: Paginator,
private val store: Sources.Local.Settings,
logger: Logger
) : CursorSource(logger), Sources.Local.Pragma {
private val store: Sources.Local.Settings
) : CursorSource(), Sources.Local.Pragma {

override suspend fun getUserVersion(query: Query): QueryResult =
store.current().let {
Expand Down
Loading

0 comments on commit d5b0aa4

Please sign in to comment.