Updated dependencies and copyright.
This commit is contained in:
parent
7f18ee1f34
commit
035aa73fab
11 changed files with 60 additions and 61 deletions
12
.idea/isgd-shorten.iml
generated
12
.idea/isgd-shorten.iml
generated
|
@ -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>
|
5
.idea/jarRepositories.xml
generated
5
.idea/jarRepositories.xml
generated
|
@ -36,5 +36,10 @@
|
|||
<option name="name" value="maven" />
|
||||
<option name="url" value="https://oss.sonatype.org/content/repositories/snapshots" />
|
||||
</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>
|
||||
</project>
|
8
.idea/modules.xml
generated
8
.idea/modules.xml
generated
|
@ -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>
|
|
@ -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.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -3,18 +3,18 @@ import org.gradle.api.tasks.testing.logging.TestExceptionFormat
|
|||
import org.gradle.api.tasks.testing.logging.TestLogEvent
|
||||
|
||||
plugins {
|
||||
id("com.github.ben-manes.versions") version "0.39.0"
|
||||
id("io.gitlab.arturbosch.detekt") version "1.18.1"
|
||||
id("jacoco")
|
||||
id("com.github.ben-manes.versions") version "0.40.0"
|
||||
id("io.gitlab.arturbosch.detekt") version "1.19.0"
|
||||
id("java")
|
||||
id("java-library")
|
||||
id("maven-publish")
|
||||
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("signing")
|
||||
kotlin("jvm") version "1.5.31"
|
||||
kotlin("kapt") version "1.5.31"
|
||||
kotlin("jvm") version "1.6.10"
|
||||
kotlin("kapt") version "1.6.10"
|
||||
}
|
||||
|
||||
group = "net.thauvin.erik"
|
||||
|
@ -56,6 +56,7 @@ sonarqube {
|
|||
property("sonar.organization", "ethauvin-github")
|
||||
property("sonar.host.url", "https://sonarcloud.io")
|
||||
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")
|
||||
}
|
||||
|
||||
jacoco {
|
||||
toolVersion = "0.8.7"
|
||||
}
|
||||
|
||||
jacocoTestReport {
|
||||
dependsOn(test)
|
||||
reports {
|
||||
xml.required.set(true)
|
||||
html.required.set(true)
|
||||
}
|
||||
}
|
||||
|
||||
assemble {
|
||||
dependsOn(javadocJar)
|
||||
}
|
||||
|
@ -144,7 +133,7 @@ tasks {
|
|||
}
|
||||
|
||||
"sonarqube" {
|
||||
dependsOn(jacocoTestReport)
|
||||
dependsOn(koverReport)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
|||
|
||||
plugins {
|
||||
id("application")
|
||||
id("com.github.ben-manes.versions") version "0.39.0"
|
||||
kotlin("jvm") version "1.5.31"
|
||||
id("com.github.ben-manes.versions") version "0.40.0"
|
||||
kotlin("jvm") version "1.6.10"
|
||||
}
|
||||
|
||||
// ./gradlew run --args='https://www.example.com https://is.gd/Pt2sET'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
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
|
||||
zipStorePath=wrapper/dists
|
||||
|
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,5 +1,5 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
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
|
||||
zipStorePath=wrapper/dists
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Isgd.kt
|
||||
*
|
||||
* Copyright (c) 2020-2021, Erik C. Thauvin (erik@thauvin.net)
|
||||
* Copyright (c) 2022, Erik C. Thauvin (erik@thauvin.net)
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* IsgdException.kt
|
||||
*
|
||||
* Copyright (c) 2020-2021, Erik C. Thauvin (erik@thauvin.net)
|
||||
* Copyright (c) 2022, Erik C. Thauvin (erik@thauvin.net)
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* IsgdTest.kt
|
||||
*
|
||||
* Copyright (c) 2020-2021, Erik C. Thauvin (erik@thauvin.net)
|
||||
* Copyright (c) 2022, Erik C. Thauvin (erik@thauvin.net)
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -45,9 +45,9 @@ class IsgdTest {
|
|||
@Test
|
||||
fun testException() {
|
||||
assertFailsWith(
|
||||
message = "URL is already shorten",
|
||||
exceptionClass = IsgdException::class,
|
||||
block = { Isgd.shorten(shortUrl) }
|
||||
message = "URL is already shorten",
|
||||
exceptionClass = IsgdException::class,
|
||||
block = { Isgd.shorten(shortUrl) }
|
||||
)
|
||||
|
||||
try {
|
||||
|
@ -58,6 +58,15 @@ class IsgdTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testLookup() {
|
||||
assertFailsWith(
|
||||
message = "empty url",
|
||||
exceptionClass = IllegalArgumentException::class,
|
||||
block = { Isgd.lookup("") }
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testLookupDefault() {
|
||||
assertEquals(url, Isgd.lookup(shortUrl))
|
||||
|
@ -68,17 +77,32 @@ class IsgdTest {
|
|||
fun testLookupJson() {
|
||||
assertEquals("{ \"url\": \"$url\" }", Isgd.lookup(shortUrl, format = Format.JSON))
|
||||
assertEquals(
|
||||
"test({ \"url\": \"$url\" });",
|
||||
Isgd.lookup(shortUrl, callback = "test", format = Format.JSON),
|
||||
"with callback"
|
||||
"test({ \"url\": \"$url\" });",
|
||||
Isgd.lookup(shortUrl, callback = "test", format = Format.JSON),
|
||||
"with callback"
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testLookupXml() {
|
||||
assertEquals(
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><output><url>$url</url></output>",
|
||||
Isgd.lookup(shortUrl, format = Format.XML)
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><output><url>$url</url></output>",
|
||||
Isgd.lookup(shortUrl, format = Format.XML)
|
||||
)
|
||||
}
|
||||
|
||||
@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") }
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -86,24 +110,25 @@ class IsgdTest {
|
|||
fun testShortenDefault() {
|
||||
assertEquals(shortUrl, Isgd.shorten(url))
|
||||
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
|
||||
fun testShortenJson() {
|
||||
assertEquals("{ \"shorturl\": \"$shortUrl\" }", Isgd.shorten(url, format = Format.JSON))
|
||||
assertEquals(
|
||||
"test({ \"shorturl\": \"$shortUrl\" });",
|
||||
Isgd.shorten(url, callback = "test", format = Format.JSON),
|
||||
"with callback"
|
||||
"test({ \"shorturl\": \"$shortUrl\" });",
|
||||
Isgd.shorten(url, callback = "test", format = Format.JSON),
|
||||
"with callback"
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testShortenXml() {
|
||||
assertEquals(
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" +
|
||||
"<output><shorturl>$shortUrl</shorturl></output>",
|
||||
Isgd.shorten(url, format = Format.XML)
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" +
|
||||
"<output><shorturl>$shortUrl</shorturl></output>",
|
||||
Isgd.shorten(url, format = Format.XML)
|
||||
)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue