Updated dependencies and copyright.

This commit is contained in:
Erik C. Thauvin 2022-01-03 12:27:33 -08:00
parent 7f18ee1f34
commit 035aa73fab
11 changed files with 60 additions and 61 deletions

12
.idea/isgd-shorten.iml generated
View file

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="isgd-shorten" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="net.thauvin.erik" external.system.module.version="0.9.2-SNAPSHOT" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
<excludeFolder url="file://$MODULE_DIR$/build" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View file

@ -36,5 +36,10 @@
<option name="name" value="maven" /> <option name="name" value="maven" />
<option name="url" value="https://oss.sonatype.org/content/repositories/snapshots" /> <option name="url" value="https://oss.sonatype.org/content/repositories/snapshots" />
</remote-repository> </remote-repository>
<remote-repository>
<option name="id" value="maven" />
<option name="name" value="maven" />
<option name="url" value="https://packages.jetbrains.team/maven/p/ij/intellij-dependencies" />
</remote-repository>
</component> </component>
</project> </project>

8
.idea/modules.xml generated
View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/isgd-shorten.iml" filepath="$PROJECT_DIR$/.idea/isgd-shorten.iml" />
</modules>
</component>
</project>

View file

@ -1,4 +1,4 @@
Copyright (c) 2020-2021, Erik C. Thauvin (erik@thauvin.net) Copyright (c) 2020-2022, Erik C. Thauvin (erik@thauvin.net)
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without

View file

@ -3,18 +3,18 @@ import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent import org.gradle.api.tasks.testing.logging.TestLogEvent
plugins { plugins {
id("com.github.ben-manes.versions") version "0.39.0" id("com.github.ben-manes.versions") version "0.40.0"
id("io.gitlab.arturbosch.detekt") version "1.18.1" id("io.gitlab.arturbosch.detekt") version "1.19.0"
id("jacoco")
id("java") id("java")
id("java-library") id("java-library")
id("maven-publish") id("maven-publish")
id("net.thauvin.erik.gradle.semver") version "1.0.4" id("net.thauvin.erik.gradle.semver") version "1.0.4"
id("org.jetbrains.dokka") version "1.5.30" id("org.jetbrains.dokka") version "1.6.10"
id("org.jetbrains.kotlinx.kover") version "0.4.4"
id("org.sonarqube") version "3.3" id("org.sonarqube") version "3.3"
id("signing") id("signing")
kotlin("jvm") version "1.5.31" kotlin("jvm") version "1.6.10"
kotlin("kapt") version "1.5.31" kotlin("kapt") version "1.6.10"
} }
group = "net.thauvin.erik" group = "net.thauvin.erik"
@ -56,6 +56,7 @@ sonarqube {
property("sonar.organization", "ethauvin-github") property("sonar.organization", "ethauvin-github")
property("sonar.host.url", "https://sonarcloud.io") property("sonar.host.url", "https://sonarcloud.io")
property("sonar.sourceEncoding", "UTF-8") property("sonar.sourceEncoding", "UTF-8")
property("sonar.coverage.jacoco.xmlReportPaths", "${project.buildDir}/reports/kover/report.xml")
} }
} }
@ -83,18 +84,6 @@ tasks {
destination = file("$projectDir/pom.xml") destination = file("$projectDir/pom.xml")
} }
jacoco {
toolVersion = "0.8.7"
}
jacocoTestReport {
dependsOn(test)
reports {
xml.required.set(true)
html.required.set(true)
}
}
assemble { assemble {
dependsOn(javadocJar) dependsOn(javadocJar)
} }
@ -144,7 +133,7 @@ tasks {
} }
"sonarqube" { "sonarqube" {
dependsOn(jacocoTestReport) dependsOn(koverReport)
} }
} }

View file

@ -2,8 +2,8 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins { plugins {
id("application") id("application")
id("com.github.ben-manes.versions") version "0.39.0" id("com.github.ben-manes.versions") version "0.40.0"
kotlin("jvm") version "1.5.31" kotlin("jvm") version "1.6.10"
} }
// ./gradlew run --args='https://www.example.com https://is.gd/Pt2sET' // ./gradlew run --args='https://www.example.com https://is.gd/Pt2sET'

View file

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View file

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View file

@ -1,7 +1,7 @@
/* /*
* Isgd.kt * Isgd.kt
* *
* Copyright (c) 2020-2021, Erik C. Thauvin (erik@thauvin.net) * Copyright (c) 2022, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View file

@ -1,7 +1,7 @@
/* /*
* IsgdException.kt * IsgdException.kt
* *
* Copyright (c) 2020-2021, Erik C. Thauvin (erik@thauvin.net) * Copyright (c) 2022, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View file

@ -1,7 +1,7 @@
/* /*
* IsgdTest.kt * IsgdTest.kt
* *
* Copyright (c) 2020-2021, Erik C. Thauvin (erik@thauvin.net) * Copyright (c) 2022, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -58,6 +58,15 @@ class IsgdTest {
} }
} }
@Test
fun testLookup() {
assertFailsWith(
message = "empty url",
exceptionClass = IllegalArgumentException::class,
block = { Isgd.lookup("") }
)
}
@Test @Test
fun testLookupDefault() { fun testLookupDefault() {
assertEquals(url, Isgd.lookup(shortUrl)) assertEquals(url, Isgd.lookup(shortUrl))
@ -82,10 +91,26 @@ class IsgdTest {
) )
} }
@Test
fun testShorten() {
assertFailsWith(
message = "empty url",
exceptionClass = IllegalArgumentException::class,
block = { Isgd.shorten("") }
)
assertFailsWith(
message = "shorturl already take",
exceptionClass = IsgdException::class,
block = { Isgd.shorten(url, shorturl = "test") }
)
}
@Test @Test
fun testShortenDefault() { fun testShortenDefault() {
assertEquals(shortUrl, Isgd.shorten(url)) assertEquals(shortUrl, Isgd.shorten(url))
assertEquals(shortVgdUrl, Isgd.shorten(url, isVgd = true), "v.gd") assertEquals(shortVgdUrl, Isgd.shorten(url, isVgd = true), "v.gd")
assertTrue(Isgd.shorten(url, logstats = true).matches("https://is.gd/\\w{6}".toRegex()), "with logstats")
} }
@Test @Test