named module, update to Gradle 6.4.1
This commit is contained in:
parent
57bf687464
commit
0f6ed0195f
34 changed files with 1801 additions and 491 deletions
117
build.gradle
117
build.gradle
|
@ -1,102 +1,33 @@
|
||||||
plugins {
|
plugins {
|
||||||
id "org.sonarqube" version '2.2'
|
id "de.marcphilipp.nexus-publish" version "0.4.0"
|
||||||
id "org.xbib.gradle.plugin.asciidoctor" version "1.5.4.1.0"
|
id "io.codearte.nexus-staging" version "0.21.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
printf "Host: %s\nOS: %s %s %s\nJVM: %s %s %s %s\nGroovy: %s\nGradle: %s\n" +
|
wrapper {
|
||||||
"Build: group: ${project.group} name: ${project.name} version: ${project.version}\n",
|
gradleVersion = "${project.property('gradle.wrapper.version')}"
|
||||||
InetAddress.getLocalHost(),
|
distributionType = Wrapper.DistributionType.ALL
|
||||||
System.getProperty("os.name"),
|
|
||||||
System.getProperty("os.arch"),
|
|
||||||
System.getProperty("os.version"),
|
|
||||||
System.getProperty("java.version"),
|
|
||||||
System.getProperty("java.vm.version"),
|
|
||||||
System.getProperty("java.vm.vendor"),
|
|
||||||
System.getProperty("java.vm.name"),
|
|
||||||
GroovySystem.getVersion(),
|
|
||||||
gradle.gradleVersion
|
|
||||||
|
|
||||||
|
|
||||||
apply plugin: 'java'
|
|
||||||
apply plugin: 'maven'
|
|
||||||
apply plugin: 'signing'
|
|
||||||
apply plugin: 'findbugs'
|
|
||||||
apply plugin: 'pmd'
|
|
||||||
apply plugin: 'checkstyle'
|
|
||||||
apply plugin: 'jacoco'
|
|
||||||
apply plugin: 'org.xbib.gradle.plugin.asciidoctor'
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
mavenCentral()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
configurations {
|
ext {
|
||||||
asciidoclet
|
user = 'xbib'
|
||||||
wagon
|
name = 'standardnumber'
|
||||||
|
description = 'Standardnumber processing for Java'
|
||||||
|
inceptionYear = '2016'
|
||||||
|
url = 'https://github.com/' + user + '/' + name
|
||||||
|
scmUrl = 'https://github.com/' + user + '/' + name
|
||||||
|
scmConnection = 'scm:git:git://github.com/' + user + '/' + name + '.git'
|
||||||
|
scmDeveloperConnection = 'scm:git:ssh://git@github.com:' + user + '/' + name + '.git'
|
||||||
|
issueManagementSystem = 'Github'
|
||||||
|
issueManagementUrl = ext.scmUrl + '/issues'
|
||||||
|
licenseName = 'The Apache License, Version 2.0'
|
||||||
|
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
apply plugin: 'java-library'
|
||||||
testCompile 'junit:junit:4.12'
|
|
||||||
asciidoclet 'org.asciidoctor:asciidoclet:1.5.4'
|
|
||||||
wagon 'org.apache.maven.wagon:wagon-ssh-external:2.10'
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
apply from: rootProject.file('gradle/ide/idea.gradle')
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
apply from: rootProject.file('gradle/compile/java.gradle')
|
||||||
|
apply from: rootProject.file('gradle/test/junit5.gradle')
|
||||||
|
apply from: rootProject.file('gradle/publishing/publication.gradle')
|
||||||
|
apply from: rootProject.file('gradle/publishing/sonatype.gradle')
|
||||||
|
|
||||||
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
|
||||||
tasks.withType(JavaCompile) {
|
|
||||||
options.compilerArgs << "-Xlint:all" << "-profile" << "compact2"
|
|
||||||
}
|
|
||||||
|
|
||||||
test {
|
|
||||||
testLogging {
|
|
||||||
showStandardStreams = false
|
|
||||||
exceptionFormat = 'full'
|
|
||||||
}
|
|
||||||
reports.html.destination = file("${projectDir}/docs/test")
|
|
||||||
}
|
|
||||||
|
|
||||||
asciidoctor {
|
|
||||||
backends 'html5'
|
|
||||||
outputDir = file("${projectDir}/docs")
|
|
||||||
separateOutputDirs = false
|
|
||||||
attributes 'source-highlighter': 'coderay',
|
|
||||||
toc : '',
|
|
||||||
idprefix : '',
|
|
||||||
idseparator : '-',
|
|
||||||
stylesheet: "${projectDir}/src/docs/asciidoc/css/foundation.css"
|
|
||||||
}
|
|
||||||
|
|
||||||
javadoc {
|
|
||||||
options.docletpath = configurations.asciidoclet.files.asType(List)
|
|
||||||
options.doclet = 'org.asciidoctor.Asciidoclet'
|
|
||||||
options.overview = "src/docs/asciidoclet/overview.adoc"
|
|
||||||
options.addStringOption "-base-dir", "${projectDir}"
|
|
||||||
options.addStringOption "-attribute",
|
|
||||||
"name=${project.name},version=${project.version},title-link=https://github.com/xbib/${project.name}"
|
|
||||||
options.destinationDirectory(file("${projectDir}/docs/javadoc"))
|
|
||||||
configure(options) {
|
|
||||||
noTimestamp = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
task sourcesJar(type: Jar, dependsOn: classes) {
|
|
||||||
classifier 'sources'
|
|
||||||
from sourceSets.main.allSource
|
|
||||||
}
|
|
||||||
task javadocJar(type: Jar, dependsOn: javadoc) {
|
|
||||||
classifier 'javadoc'
|
|
||||||
}
|
|
||||||
artifacts {
|
|
||||||
archives sourcesJar, javadocJar
|
|
||||||
}
|
|
||||||
if (project.hasProperty('signing.keyId')) {
|
|
||||||
signing {
|
|
||||||
sign configurations.archives
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
apply from: 'gradle/ext.gradle'
|
|
||||||
apply from: 'gradle/publish.gradle'
|
|
||||||
apply from: 'gradle/sonarqube.gradle'
|
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
group = org.xbib
|
group = org.xbib
|
||||||
name = standardnumber
|
name = standardnumber
|
||||||
version = 1.0.1
|
version = 1.1.0
|
||||||
|
|
||||||
|
gradle.wrapper.version = 6.4.1
|
||||||
|
|
||||||
|
|
43
gradle/compile/java.gradle
Normal file
43
gradle/compile/java.gradle
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
|
||||||
|
apply plugin: 'java-library'
|
||||||
|
|
||||||
|
java {
|
||||||
|
modularity.inferModulePath.set(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
compileJava {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_11
|
||||||
|
targetCompatibility = JavaVersion.VERSION_11
|
||||||
|
}
|
||||||
|
|
||||||
|
compileTestJava {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_11
|
||||||
|
targetCompatibility = JavaVersion.VERSION_11
|
||||||
|
}
|
||||||
|
|
||||||
|
jar {
|
||||||
|
manifest {
|
||||||
|
attributes('Implementation-Version': project.version)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task sourcesJar(type: Jar, dependsOn: classes) {
|
||||||
|
classifier 'sources'
|
||||||
|
from sourceSets.main.allSource
|
||||||
|
}
|
||||||
|
|
||||||
|
task javadocJar(type: Jar, dependsOn: javadoc) {
|
||||||
|
classifier 'javadoc'
|
||||||
|
}
|
||||||
|
|
||||||
|
artifacts {
|
||||||
|
archives sourcesJar, javadocJar
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType(JavaCompile) {
|
||||||
|
options.compilerArgs << '-Xlint:all'
|
||||||
|
}
|
||||||
|
|
||||||
|
javadoc {
|
||||||
|
options.addStringOption('Xdoclint:none', '-quiet')
|
||||||
|
}
|
55
gradle/documentation/asciidoc.gradle
Normal file
55
gradle/documentation/asciidoc.gradle
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
apply plugin: 'org.xbib.gradle.plugin.asciidoctor'
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
asciidoclet
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
asciidoclet "org.asciidoctor:asciidoclet:${project.property('asciidoclet.version')}"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
asciidoctor {
|
||||||
|
backends 'html5'
|
||||||
|
outputDir = file("${rootProject.projectDir}/docs")
|
||||||
|
separateOutputDirs = false
|
||||||
|
attributes 'source-highlighter': 'coderay',
|
||||||
|
idprefix: '',
|
||||||
|
idseparator: '-',
|
||||||
|
toc: 'left',
|
||||||
|
doctype: 'book',
|
||||||
|
icons: 'font',
|
||||||
|
encoding: 'utf-8',
|
||||||
|
sectlink: true,
|
||||||
|
sectanchors: true,
|
||||||
|
linkattrs: true,
|
||||||
|
imagesdir: 'img',
|
||||||
|
stylesheet: "${projectDir}/src/docs/asciidoc/css/foundation.css"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*javadoc {
|
||||||
|
options.docletpath = configurations.asciidoclet.files.asType(List)
|
||||||
|
options.doclet = 'org.asciidoctor.Asciidoclet'
|
||||||
|
//options.overview = "src/docs/asciidoclet/overview.adoc"
|
||||||
|
options.addStringOption "-base-dir", "${projectDir}"
|
||||||
|
options.addStringOption "-attribute",
|
||||||
|
"name=${project.name},version=${project.version},title-link=https://github.com/xbib/${project.name}"
|
||||||
|
configure(options) {
|
||||||
|
noTimestamp = true
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
/*javadoc {
|
||||||
|
options.docletpath = configurations.asciidoclet.files.asType(List)
|
||||||
|
options.doclet = 'org.asciidoctor.Asciidoclet'
|
||||||
|
options.overview = "${rootProject.projectDir}/src/docs/asciidoclet/overview.adoc"
|
||||||
|
options.addStringOption "-base-dir", "${projectDir}"
|
||||||
|
options.addStringOption "-attribute",
|
||||||
|
"name=${project.name},version=${project.version},title-link=https://github.com/xbib/${project.name}"
|
||||||
|
options.destinationDirectory(file("${projectDir}/docs/javadoc"))
|
||||||
|
configure(options) {
|
||||||
|
noTimestamp = true
|
||||||
|
}
|
||||||
|
}*/
|
|
@ -1,8 +0,0 @@
|
||||||
ext {
|
|
||||||
user = 'xbib'
|
|
||||||
projectName = 'standardnumber'
|
|
||||||
projectDescription = 'Standardnumber processing for Java'
|
|
||||||
scmUrl = 'https://github.com/xbib/standardnumber'
|
|
||||||
scmConnection = 'scm:git:git://github.com/xbib/standardnumber.git'
|
|
||||||
scmDeveloperConnection = 'scm:git:git://github.com/xbib/standardnumber.git'
|
|
||||||
}
|
|
13
gradle/ide/idea.gradle
Normal file
13
gradle/ide/idea.gradle
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
apply plugin: 'idea'
|
||||||
|
|
||||||
|
idea {
|
||||||
|
module {
|
||||||
|
outputDir file('build/classes/java/main')
|
||||||
|
testOutputDir file('build/classes/java/test')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (project.convention.findPlugin(JavaPluginConvention)) {
|
||||||
|
//sourceSets.main.output.classesDirs = file("build/classes/java/main")
|
||||||
|
//sourceSets.test.output.classesDirs = file("build/classes/java/test")
|
||||||
|
}
|
|
@ -1,66 +0,0 @@
|
||||||
|
|
||||||
task xbibUpload(type: Upload, dependsOn: build) {
|
|
||||||
configuration = configurations.archives
|
|
||||||
uploadDescriptor = true
|
|
||||||
repositories {
|
|
||||||
if (project.hasProperty('xbibUsername')) {
|
|
||||||
mavenDeployer {
|
|
||||||
configuration = configurations.wagon
|
|
||||||
repository(url: uri('scpexe://xbib.org/repository')) {
|
|
||||||
authentication(userName: xbibUsername, privateKey: xbibPrivateKey)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
task sonatypeUpload(type: Upload, dependsOn: build) {
|
|
||||||
configuration = configurations.archives
|
|
||||||
uploadDescriptor = true
|
|
||||||
repositories {
|
|
||||||
if (project.hasProperty('ossrhUsername')) {
|
|
||||||
mavenDeployer {
|
|
||||||
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
|
|
||||||
repository(url: uri(ossrhReleaseUrl)) {
|
|
||||||
authentication(userName: ossrhUsername, password: ossrhPassword)
|
|
||||||
}
|
|
||||||
snapshotRepository(url: uri(ossrhSnapshotUrl)) {
|
|
||||||
authentication(userName: ossrhUsername, password: ossrhPassword)
|
|
||||||
}
|
|
||||||
pom.project {
|
|
||||||
groupId project.group
|
|
||||||
artifactId project.name
|
|
||||||
version project.version
|
|
||||||
name project.name
|
|
||||||
description projectDescription
|
|
||||||
packaging 'jar'
|
|
||||||
inceptionYear '2016'
|
|
||||||
url scmUrl
|
|
||||||
organization {
|
|
||||||
name 'xbib'
|
|
||||||
url 'http://xbib.org'
|
|
||||||
}
|
|
||||||
developers {
|
|
||||||
developer {
|
|
||||||
id user
|
|
||||||
name 'Jörg Prante'
|
|
||||||
email 'joergprante@gmail.com'
|
|
||||||
url 'https://github.com/jprante'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
scm {
|
|
||||||
url scmUrl
|
|
||||||
connection scmConnection
|
|
||||||
developerConnection scmDeveloperConnection
|
|
||||||
}
|
|
||||||
licenses {
|
|
||||||
license {
|
|
||||||
name 'The Apache License, Version 2.0'
|
|
||||||
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
64
gradle/publishing/publication.gradle
Normal file
64
gradle/publishing/publication.gradle
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
|
||||||
|
apply plugin: "de.marcphilipp.nexus-publish"
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
mavenJava(MavenPublication) {
|
||||||
|
from components.java
|
||||||
|
artifact sourcesJar
|
||||||
|
artifact javadocJar
|
||||||
|
pom {
|
||||||
|
name = project.name
|
||||||
|
description = rootProject.ext.description
|
||||||
|
url = rootProject.ext.url
|
||||||
|
inceptionYear = rootProject.ext.inceptionYear
|
||||||
|
packaging = 'jar'
|
||||||
|
organization {
|
||||||
|
name = 'xbib'
|
||||||
|
url = 'https://xbib.org'
|
||||||
|
}
|
||||||
|
developers {
|
||||||
|
developer {
|
||||||
|
id = 'jprante'
|
||||||
|
name = 'Jörg Prante'
|
||||||
|
email = 'joergprante@gmail.com'
|
||||||
|
url = 'https://github.com/jprante'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
scm {
|
||||||
|
url = rootProject.ext.scmUrl
|
||||||
|
connection = rootProject.ext.scmConnection
|
||||||
|
developerConnection = rootProject.ext.scmDeveloperConnection
|
||||||
|
}
|
||||||
|
issueManagement {
|
||||||
|
system = rootProject.ext.issueManagementSystem
|
||||||
|
url = rootProject.ext.issueManagementUrl
|
||||||
|
}
|
||||||
|
licenses {
|
||||||
|
license {
|
||||||
|
name = rootProject.ext.licenseName
|
||||||
|
url = rootProject.ext.licenseUrl
|
||||||
|
distribution = 'repo'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (project.hasProperty("signing.keyId")) {
|
||||||
|
apply plugin: 'signing'
|
||||||
|
signing {
|
||||||
|
sign publishing.publications.mavenJava
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nexusPublishing {
|
||||||
|
repositories {
|
||||||
|
sonatype {
|
||||||
|
username = project.property('ossrhUsername')
|
||||||
|
password = project.property('ossrhPassword')
|
||||||
|
packageGroup = "org.xbib"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
gradle/publishing/sonatype.gradle
Normal file
11
gradle/publishing/sonatype.gradle
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
|
||||||
|
if (project.hasProperty('ossrhUsername') && project.hasProperty('ossrhPassword')) {
|
||||||
|
|
||||||
|
apply plugin: 'io.codearte.nexus-staging'
|
||||||
|
|
||||||
|
nexusStaging {
|
||||||
|
username = project.property('ossrhUsername')
|
||||||
|
password = project.property('ossrhPassword')
|
||||||
|
packageGroup = "org.xbib"
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,41 +0,0 @@
|
||||||
tasks.withType(FindBugs) {
|
|
||||||
ignoreFailures = true
|
|
||||||
reports {
|
|
||||||
xml.enabled = true
|
|
||||||
html.enabled = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
tasks.withType(Pmd) {
|
|
||||||
ignoreFailures = true
|
|
||||||
reports {
|
|
||||||
xml.enabled = true
|
|
||||||
html.enabled = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
tasks.withType(Checkstyle) {
|
|
||||||
ignoreFailures = true
|
|
||||||
reports {
|
|
||||||
xml.enabled = true
|
|
||||||
html.enabled = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
jacocoTestReport {
|
|
||||||
reports {
|
|
||||||
xml.enabled true
|
|
||||||
csv.enabled false
|
|
||||||
xml.destination "${buildDir}/reports/jacoco-xml"
|
|
||||||
html.destination "${buildDir}/reports/jacoco-html"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sonarqube {
|
|
||||||
properties {
|
|
||||||
property "sonar.projectName", "${project.group} ${project.name}"
|
|
||||||
property "sonar.sourceEncoding", "UTF-8"
|
|
||||||
property "sonar.tests", "src/test/java"
|
|
||||||
property "sonar.scm.provider", "git"
|
|
||||||
property "sonar.java.coveragePlugin", "jacoco"
|
|
||||||
property "sonar.junit.reportsPath", "build/test-results/test/"
|
|
||||||
}
|
|
||||||
}
|
|
27
gradle/test/junit5.gradle
Normal file
27
gradle/test/junit5.gradle
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
|
||||||
|
def junitVersion = project.hasProperty('junit.version')?project.property('junit.version'):'5.6.2'
|
||||||
|
def hamcrestVersion = project.hasProperty('hamcrest.version')?project.property('hamcrest.version'):'2.2'
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
testImplementation "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
|
||||||
|
testImplementation "org.junit.jupiter:junit-jupiter-params:${junitVersion}"
|
||||||
|
testImplementation "org.hamcrest:hamcrest-library:${hamcrestVersion}"
|
||||||
|
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
|
||||||
|
}
|
||||||
|
|
||||||
|
test {
|
||||||
|
useJUnitPlatform()
|
||||||
|
failFast = true
|
||||||
|
testLogging {
|
||||||
|
events 'STARTED', 'PASSED', 'FAILED', 'SKIPPED'
|
||||||
|
}
|
||||||
|
afterSuite { desc, result ->
|
||||||
|
if (!desc.parent) {
|
||||||
|
println "\nTest result: ${result.resultType}"
|
||||||
|
println "Test summary: ${result.testCount} tests, " +
|
||||||
|
"${result.successfulTestCount} succeeded, " +
|
||||||
|
"${result.failedTestCount} failed, " +
|
||||||
|
"${result.skippedTestCount} skipped"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,5 @@
|
||||||
#Mon Jan 30 21:28:38 CET 2017
|
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-all.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
|
|
||||||
|
|
53
gradlew
vendored
53
gradlew
vendored
|
@ -1,5 +1,21 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright 2015 the original author or authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
##
|
##
|
||||||
## Gradle start up script for UN*X
|
## Gradle start up script for UN*X
|
||||||
|
@ -28,7 +44,7 @@ APP_NAME="Gradle"
|
||||||
APP_BASE_NAME=`basename "$0"`
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
DEFAULT_JVM_OPTS=""
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD="maximum"
|
MAX_FD="maximum"
|
||||||
|
@ -66,6 +82,7 @@ esac
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
# Determine the Java command to use to start the JVM.
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
@ -109,10 +126,11 @@ if $darwin; then
|
||||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# For Cygwin, switch paths to Windows format before running java
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
if $cygwin ; then
|
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
# We build the pattern for arguments to be converted via cygpath
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
@ -138,19 +156,19 @@ if $cygwin ; then
|
||||||
else
|
else
|
||||||
eval `echo args$i`="\"$arg\""
|
eval `echo args$i`="\"$arg\""
|
||||||
fi
|
fi
|
||||||
i=$((i+1))
|
i=`expr $i + 1`
|
||||||
done
|
done
|
||||||
case $i in
|
case $i in
|
||||||
(0) set -- ;;
|
0) set -- ;;
|
||||||
(1) set -- "$args0" ;;
|
1) set -- "$args0" ;;
|
||||||
(2) set -- "$args0" "$args1" ;;
|
2) set -- "$args0" "$args1" ;;
|
||||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -159,14 +177,9 @@ save ( ) {
|
||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||||
echo " "
|
echo " "
|
||||||
}
|
}
|
||||||
APP_ARGS=$(save "$@")
|
APP_ARGS=`save "$@"`
|
||||||
|
|
||||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||||
|
|
||||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
|
||||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
|
||||||
cd "$(dirname "$0")"
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
exec "$JAVACMD" "$@"
|
||||||
|
|
22
gradlew.bat
vendored
22
gradlew.bat
vendored
|
@ -1,3 +1,19 @@
|
||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
|
||||||
@if "%DEBUG%" == "" @echo off
|
@if "%DEBUG%" == "" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
|
@ -13,8 +29,11 @@ if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
set DEFAULT_JVM_OPTS=
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
@rem Find java.exe
|
@rem Find java.exe
|
||||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
@ -65,6 +84,7 @@ set CMD_LINE_ARGS=%*
|
||||||
|
|
||||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
@rem Execute Gradle
|
@rem Execute Gradle
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||||
|
|
||||||
|
|
6
src/main/java/module-info.java
Normal file
6
src/main/java/module-info.java
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
module org.xbib.standardnumber {
|
||||||
|
exports org.xbib.standardnumber;
|
||||||
|
exports org.xbib.standardnumber.checksum;
|
||||||
|
exports org.xbib.standardnumber.checksum.iso7064;
|
||||||
|
requires java.xml; // for reading ISBN config file
|
||||||
|
}
|
|
@ -6,7 +6,6 @@ import java.util.Locale;
|
||||||
*/
|
*/
|
||||||
abstract class StandardNumberSpi {
|
abstract class StandardNumberSpi {
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public static StandardNumber getInstance(String type) throws NoSuchStandardNumberException {
|
public static StandardNumber getInstance(String type) throws NoSuchStandardNumberException {
|
||||||
return getInstance(StandardNumberSpi.class.getPackage(), StandardNumberSpi.class.getClassLoader(), type);
|
return getInstance(StandardNumberSpi.class.getPackage(), StandardNumberSpi.class.getClassLoader(), type);
|
||||||
}
|
}
|
||||||
|
@ -17,7 +16,7 @@ abstract class StandardNumberSpi {
|
||||||
String className = thePackage.getName() + "." + type.toUpperCase(Locale.ROOT);
|
String className = thePackage.getName() + "." + type.toUpperCase(Locale.ROOT);
|
||||||
try {
|
try {
|
||||||
Class<StandardNumber> clazz = (Class<StandardNumber>) classLoader.loadClass(className);
|
Class<StandardNumber> clazz = (Class<StandardNumber>) classLoader.loadClass(className);
|
||||||
return clazz.newInstance();
|
return clazz.getDeclaredConstructor().newInstance();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new NoSuchStandardNumberException(type);
|
throw new NoSuchStandardNumberException(type);
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,8 +1,7 @@
|
||||||
package org.xbib.standardnumber;
|
package org.xbib.standardnumber;
|
||||||
|
|
||||||
import org.junit.Test;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
package org.xbib.standardnumber;
|
package org.xbib.standardnumber;
|
||||||
|
|
||||||
import org.junit.Test;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
package org.xbib.standardnumber;
|
package org.xbib.standardnumber;
|
||||||
|
|
||||||
import org.junit.Test;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
package org.xbib.standardnumber;
|
package org.xbib.standardnumber;
|
||||||
|
|
||||||
import org.junit.Test;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
package org.xbib.standardnumber;
|
package org.xbib.standardnumber;
|
||||||
|
|
||||||
import org.junit.Test;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.jupiter.api.Assertions.fail;
|
||||||
import static org.junit.Assert.assertTrue;
|
import org.junit.jupiter.api.Test;
|
||||||
import static org.junit.Assert.fail;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package org.xbib.standardnumber;
|
package org.xbib.standardnumber;
|
||||||
|
|
||||||
import org.junit.Test;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
import static org.junit.Assert.assertEquals;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -14,9 +14,10 @@ public class ISBNTests {
|
||||||
assertEquals("000111333", new ISBN().set("000-111-333").normalize().normalizedValue());
|
assertEquals("000111333", new ISBN().set("000-111-333").normalize().normalizedValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = IllegalArgumentException.class)
|
@Test
|
||||||
public void testISBNTooShort() throws Exception {
|
public void testISBNTooShort() {
|
||||||
new ISBN().set("12-7").normalize().verify();
|
Assertions.assertThrows(IllegalArgumentException.class, () ->
|
||||||
|
new ISBN().set("12-7").normalize().verify());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -26,10 +27,12 @@ public class ISBNTests {
|
||||||
assertEquals(isbn.normalizedValue(), "3980335054");
|
assertEquals(isbn.normalizedValue(), "3980335054");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test
|
||||||
public void testTruncatedISBN() throws Exception {
|
public void testTruncatedISBN() {
|
||||||
|
Assertions.assertThrows(NumberFormatException.class, () -> {
|
||||||
String value = "ISBN";
|
String value = "ISBN";
|
||||||
new ISBN().set(value).normalize().verify();
|
new ISBN().set(value).normalize().verify();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -40,7 +43,7 @@ public class ISBNTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEAN() throws Exception {
|
public void testEAN() {
|
||||||
String value = "978-3-551-75213-0";
|
String value = "978-3-551-75213-0";
|
||||||
StandardNumber isbn = new ISBN().ean(true).set(value).normalize().verify();
|
StandardNumber isbn = new ISBN().ean(true).set(value).normalize().verify();
|
||||||
assertEquals("9783551752130", isbn.normalizedValue());
|
assertEquals("9783551752130", isbn.normalizedValue());
|
||||||
|
@ -48,22 +51,24 @@ public class ISBNTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEAN2() throws Exception {
|
public void testEAN2() {
|
||||||
String value = "978-3-551-75213-1";
|
String value = "978-3-551-75213-1";
|
||||||
StandardNumber isbn = new ISBN().ean(true).set(value).createChecksum(true).normalize().verify();
|
StandardNumber isbn = new ISBN().ean(true).set(value).createChecksum(true).normalize().verify();
|
||||||
assertEquals("9783551752130", isbn.normalizedValue());
|
assertEquals("9783551752130", isbn.normalizedValue());
|
||||||
assertEquals("978-3-551-75213-0", isbn.format());
|
assertEquals("978-3-551-75213-0", isbn.format());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test
|
||||||
public void testWrongAndDirtyEAN() throws Exception {
|
public void testWrongAndDirtyEAN() {
|
||||||
|
Assertions.assertThrows(NumberFormatException.class, () ->{
|
||||||
// correct ISBN-10 is 3-451-04112-X
|
// correct ISBN-10 is 3-451-04112-X
|
||||||
String value = "ISBN ISBN 3-451-4112-X kart. : DM 24.80";
|
String value = "ISBN ISBN 3-451-4112-X kart. : DM 24.80";
|
||||||
new ISBN().ean(false).set(value).createChecksum(true).normalize().verify();
|
new ISBN().ean(false).set(value).createChecksum(true).normalize().verify();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testVariants() throws Exception {
|
public void testVariants() {
|
||||||
String content = "1-9339-8817-7.";
|
String content = "1-9339-8817-7.";
|
||||||
ISBN isbn = new ISBN();
|
ISBN isbn = new ISBN();
|
||||||
isbn.set(content).normalize();
|
isbn.set(content).normalize();
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
package org.xbib.standardnumber;
|
package org.xbib.standardnumber;
|
||||||
|
|
||||||
import org.junit.Test;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
package org.xbib.standardnumber;
|
package org.xbib.standardnumber;
|
||||||
|
|
||||||
import org.junit.Test;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
package org.xbib.standardnumber;
|
package org.xbib.standardnumber;
|
||||||
|
|
||||||
import org.junit.Test;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
import static org.junit.Assert.assertEquals;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class ISSNTests {
|
public class ISSNTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -37,9 +36,11 @@ public class ISSNTests {
|
||||||
assertEquals(issn.createChecksum(true).toGTIN("03").normalizedValue(), "9770729011038");
|
assertEquals(issn.createChecksum(true).toGTIN("03").normalizedValue(), "9770729011038");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NumberFormatException.class)
|
@Test
|
||||||
public void testNonISSN() throws Exception {
|
public void testNonISSN() {
|
||||||
|
Assertions.assertThrows(NumberFormatException.class, () -> {
|
||||||
String value = "linux";
|
String value = "linux";
|
||||||
new ISSN().set(value).createChecksum(true).normalize().verify();
|
new ISSN().set(value).createChecksum(true).normalize().verify();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
package org.xbib.standardnumber;
|
package org.xbib.standardnumber;
|
||||||
|
|
||||||
import org.junit.Test;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
package org.xbib.standardnumber;
|
package org.xbib.standardnumber;
|
||||||
|
|
||||||
import org.junit.Test;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -10,7 +9,7 @@ import static org.junit.Assert.assertEquals;
|
||||||
public class ISWCTests {
|
public class ISWCTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testISWC() throws Exception {
|
public void testISWC() {
|
||||||
StandardNumber iswc = new ISWC().set("T-034524680-1").normalize().verify();
|
StandardNumber iswc = new ISWC().set("T-034524680-1").normalize().verify();
|
||||||
assertEquals("T0345246801", iswc.normalizedValue());
|
assertEquals("T0345246801", iswc.normalizedValue());
|
||||||
assertEquals("ISWC T-034524680-1", iswc.format());
|
assertEquals("ISWC T-034524680-1", iswc.format());
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
package org.xbib.standardnumber;
|
package org.xbib.standardnumber;
|
||||||
|
|
||||||
import org.junit.Test;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
package org.xbib.standardnumber;
|
package org.xbib.standardnumber;
|
||||||
|
|
||||||
import org.junit.Test;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
package org.xbib.standardnumber;
|
package org.xbib.standardnumber;
|
||||||
|
|
||||||
import org.junit.Test;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -10,7 +9,7 @@ import static org.junit.Assert.assertEquals;
|
||||||
public class SICITests {
|
public class SICITests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSICI1() throws Exception {
|
public void testSICI1() {
|
||||||
StandardNumber sici = new SICI().set("0095-4403(199502/03)21:3<12:WATIIB>2.0.TX;2-J").normalize().verify();
|
StandardNumber sici = new SICI().set("0095-4403(199502/03)21:3<12:WATIIB>2.0.TX;2-J").normalize().verify();
|
||||||
assertEquals("0095-4403(199502/03)21:3<12:WATIIB>2.0.TX;2-J", sici.normalizedValue());
|
assertEquals("0095-4403(199502/03)21:3<12:WATIIB>2.0.TX;2-J", sici.normalizedValue());
|
||||||
assertEquals("SICI 0095-4403(199502/03)21:3<12:WATIIB>2.0.TX;2-J", sici.format());
|
assertEquals("SICI 0095-4403(199502/03)21:3<12:WATIIB>2.0.TX;2-J", sici.format());
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
package org.xbib.standardnumber;
|
package org.xbib.standardnumber;
|
||||||
|
|
||||||
import org.junit.Test;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -10,7 +9,7 @@ import static org.junit.Assert.assertEquals;
|
||||||
public class UPCTests {
|
public class UPCTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUPC() throws Exception {
|
public void testUPC() {
|
||||||
String value = "796030114977";
|
String value = "796030114977";
|
||||||
StandardNumber upc = new UPC().set(value).normalize().verify();
|
StandardNumber upc = new UPC().set(value).normalize().verify();
|
||||||
assertEquals("796030114977", upc.normalizedValue());
|
assertEquals("796030114977", upc.normalizedValue());
|
||||||
|
@ -18,7 +17,7 @@ public class UPCTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUPC2() throws Exception {
|
public void testUPC2() {
|
||||||
String value = "036000291452";
|
String value = "036000291452";
|
||||||
StandardNumber upc = new UPC().set(value).normalize().verify();
|
StandardNumber upc = new UPC().set(value).normalize().verify();
|
||||||
assertEquals("036000291452", upc.normalizedValue());
|
assertEquals("036000291452", upc.normalizedValue());
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
package org.xbib.standardnumber;
|
package org.xbib.standardnumber;
|
||||||
|
|
||||||
import org.junit.Test;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -10,23 +9,22 @@ import static org.junit.Assert.assertEquals;
|
||||||
public class ZDBTests {
|
public class ZDBTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testZDB1() throws Exception {
|
public void testZDB1() {
|
||||||
StandardNumber zdb = new ZDB().set("127").normalize().verify();
|
StandardNumber zdb = new ZDB().set("127").normalize().verify();
|
||||||
assertEquals("127", zdb.normalizedValue());
|
assertEquals("127", zdb.normalizedValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testZDB2() throws Exception {
|
public void testZDB2() {
|
||||||
StandardNumber zdb = new ZDB().set("127976-2").normalize().verify();
|
StandardNumber zdb = new ZDB().set("127976-2").normalize().verify();
|
||||||
assertEquals("1279762", zdb.normalizedValue());
|
assertEquals("1279762", zdb.normalizedValue());
|
||||||
assertEquals("127976-2", zdb.format());
|
assertEquals("127976-2", zdb.format());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testZDB3() throws Exception {
|
public void testZDB3() {
|
||||||
StandardNumber zdb = new ZDB().set("1279760").createChecksum(true).normalize().verify();
|
StandardNumber zdb = new ZDB().set("1279760").createChecksum(true).normalize().verify();
|
||||||
assertEquals("1279762", zdb.normalizedValue());
|
assertEquals("1279762", zdb.normalizedValue());
|
||||||
assertEquals("127976-2", zdb.format());
|
assertEquals("127976-2", zdb.format());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue