initial commit

This commit is contained in:
bvn13 2022-09-25 00:14:31 +03:00
commit b6d207be59
28 changed files with 1550 additions and 0 deletions

370
.gitignore vendored Normal file
View File

@ -0,0 +1,370 @@
# Created by https://www.toptal.com/developers/gitignore/api/java,gradle,git,intellij,linux,windows,macos,node
# Edit at https://www.toptal.com/developers/gitignore?templates=java,gradle,git,intellij,linux,windows,macos,node
### Git ###
# Created by git for backups. To disable backups in Git:
# $ git config --global mergetool.keepBackup false
*.orig
# Created by git when using merge tools for conflicts
*.BACKUP.*
*.BASE.*
*.LOCAL.*
*.REMOTE.*
*_BACKUP_*.txt
*_BASE_*.txt
*_LOCAL_*.txt
*_REMOTE_*.txt
### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/.gitignore
.idea/**/.name
.idea/**/compiler.xml
.idea/**/jarRepositories.xml
.idea/**/libraries-with-intellij-classes.xml
.idea/**/misc.xml
.idea/**/vcs.xml
.idea/**/wallet-external-api.iml
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
### Intellij Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr
# Sonarlint plugin
# https://plugins.jetbrains.com/plugin/7973-sonarlint
.idea/**/sonarlint/
# SonarQube Plugin
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
.idea/**/sonarIssues.xml
# Markdown Navigator plugin
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
.idea/**/markdown-navigator.xml
.idea/**/markdown-navigator-enh.xml
.idea/**/markdown-navigator/
# Cache file creation bug
# See https://youtrack.jetbrains.com/issue/JBR-2257
.idea/$CACHE_FILE$
# CodeStream plugin
# https://plugins.jetbrains.com/plugin/12206-codestream
.idea/codestream.xml
### Java ###
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
### Linux ###
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### Node ###
# Logs
logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional stylelint cache
.stylelintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
.env*.local
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
# Nuxt.js build / generate output
.nuxt
dist
# Storybook build outputs
.out
.storybook-out
storybook-static
# rollup.js default build output
dist/
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# Temporary folders
tmp/
temp/
### Windows ###
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
### Gradle ###
.gradle
build/
# Ignore Gradle GUI config
gradle-app.setting
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar
# Cache of project
.gradletasknamecache
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
# gradle/wrapper/gradle-wrapper.properties
### Gradle Patch ###
**/build/
# End of https://www.toptal.com/developers/gitignore/api/java,gradle,git,intellij,linux,windows,macos,node

View File

@ -0,0 +1,19 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<option name="FORMATTER_TAGS_ENABLED" value="true" />
<option name="ENABLE_SECOND_REFORMAT" value="true" />
<JavaCodeStyleSettings>
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="50" />
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="2" />
</JavaCodeStyleSettings>
<JetCodeStyleSettings>
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
<ScalaCodeStyleSettings>
<option name="MULTILINE_STRING_CLOSING_QUOTES_ON_NEW_LINE" value="true" />
</ScalaCodeStyleSettings>
<codeStyleSettings language="kotlin">
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</codeStyleSettings>
</code_scheme>
</component>

View File

@ -0,0 +1,6 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>

7
.idea/encodings.xml Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/src/main/kotlin" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
</component>
</project>

6
.idea/jpa-buddy.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JpaBuddyIdeaProjectConfig">
<option name="renamerInitialized" value="true" />
</component>
</project>

6
.idea/kotlinc.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KotlinJpsPluginSettings">
<option name="version" value="1.7.10" />
</component>
</project>

8
.idea/modules.xml Normal file
View File

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

81
GpxAndroidSdk.iml Normal file
View File

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="kotlin-language" name="Kotlin">
<configuration version="5" platform="JVM 1.8" allPlatforms="JVM [1.8]" useProjectSettings="false">
<compilerSettings />
<compilerArguments>
<stringArguments>
<stringArg name="jvmTarget" arg="1.8" />
<stringArg name="apiVersion" arg="1.7" />
<stringArg name="languageVersion" arg="1.7" />
</stringArguments>
<arrayArguments>
<arrayArg name="pluginClasspaths" />
<arrayArg name="pluginOptions" />
</arrayArguments>
</compilerArguments>
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/kotlin" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/kotlin" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="TEST" name="Maven: org.jetbrains.kotlin:kotlin-test-junit5:1.7.10" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.jetbrains.kotlin:kotlin-test:1.7.10" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-engine:5.8.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-engine:1.8.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.apiguardian:apiguardian-api:1.1.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-api:5.8.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.opentest4j:opentest4j:1.2.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-commons:1.8.2" level="project" />
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10" level="project" />
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-stdlib:1.7.10" level="project" />
<orderEntry type="library" name="Maven: org.jetbrains:annotations:13.0" level="project" />
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: io.kotest:kotest-runner-junit5-jvm:5.4.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: io.kotest:kotest-framework-api-jvm:5.4.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.jetbrains.kotlinx:kotlinx-coroutines-test-jvm:1.6.4" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: io.kotest:kotest-common-jvm:5.4.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: io.kotest:kotest-framework-engine-jvm:5.4.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: io.github.classgraph:classgraph:4.8.149" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.github.ajalt:mordant:1.2.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.github.ajalt:colormath:1.2.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.jetbrains.kotlinx:kotlinx-coroutines-debug:1.6.4" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: net.java.dev.jna:jna:5.9.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: net.java.dev.jna:jna-platform:5.9.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy:1.10.9" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy-agent:1.10.9" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: io.kotest:kotest-framework-discovery-jvm:5.4.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: io.kotest:kotest-extensions-jvm:5.4.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: commons-io:commons-io:2.11.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: io.mockk:mockk:1.12.5" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: io.mockk:mockk-common:1.12.5" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: io.mockk:mockk-dsl:1.12.5" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: io.mockk:mockk-dsl-jvm:1.12.5" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: io.mockk:mockk-agent-jvm:1.12.5" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: io.mockk:mockk-agent-api:1.12.5" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: io.mockk:mockk-agent-common:1.12.5" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:3.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: io.kotest:kotest-framework-concurrency-jvm:5.4.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.4" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-suite-api:1.7.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-launcher:1.7.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.jetbrains.kotlin:kotlin-reflect:1.6.21" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: io.kotest:kotest-assertions-core-jvm:5.4.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: io.kotest:kotest-assertions-shared-jvm:5.4.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: io.github.java-diff-utils:java-diff-utils:4.12" level="project" />
<orderEntry type="library" name="Maven: org.jetbrains.kotlin:kotlin-stdlib-common:1.6.21" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.6.4" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: io.kotest:kotest-assertions-api-jvm:5.4.2" level="project" />
</component>
</module>

112
pom.xml Normal file
View File

@ -0,0 +1,112 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>GpxAndroidSdk</artifactId>
<groupId>me.bvn13.sdk.android.gpx</groupId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>consoleApp</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<kotlin.code.style>official</kotlin.code.style>
<kotlin.compiler.jvmTarget>1.8</kotlin.compiler.jvmTarget>
</properties>
<repositories>
<repository>
<id>mavenCentral</id>
<url>https://repo1.maven.org/maven2/</url>
</repository>
</repositories>
<build>
<sourceDirectory>src/main/kotlin</sourceDirectory>
<testSourceDirectory>src/test/kotlin</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>1.7.10</version>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<trimStackTrace>false</trimStackTrace>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test-junit5</artifactId>
<version>1.7.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>1.7.10</version>
</dependency>
<dependency>
<groupId>io.kotest</groupId>
<artifactId>kotest-runner-junit5-jvm</artifactId>
<version>5.4.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.kotest</groupId>
<artifactId>kotest-assertions-core-jvm</artifactId>
<version>5.4.2</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,26 @@
package me.bvn13.sdk.android.gpx
/**
* XML Node describer
*
* will be composed into XML in following format:
*
* ```xml
* <nodeName parameter1-key="parameter1-value" parameter2-key="parameter2-value">
* value
* </nodeName>
* ```
*
* [nodeName] XmlTag
*
* [value] Xml inner text
*
* [parameters] Map of key-value pairs
*/
class ExtensionType(val nodeName: String, val value: String? = null, val parameters: Map<String, String>? = null) {
init {
require(value != null || parameters != null) {
"value or parameters must be specified"
}
}
}

View File

@ -0,0 +1,12 @@
package me.bvn13.sdk.android.gpx
/**
* Type of GPS fix. none means GPS had no fix. To signify "the fix info is unknown", leave out fixType entirely. pps = military signal used
*/
enum class FixType(val value: String) {
NONE("none"),
_2D("2d"),
_3D("3d"),
DGPS("dgps"),
PPS("pps")
}

View File

@ -0,0 +1,27 @@
package me.bvn13.sdk.android.gpx
/**
* GPX documents contain a metadata header, followed by waypoints, routes, and tracks. You can add your own elements to the extensions section of the GPX document.
*
* See [official documentation](https://www.topografix.com/GPX/1/1/#element_gpx)
*
* [metadata] Metadata about the file.
*
* [wpt] A list of waypoints.
*
* [rte] A list of routes.
*
* [trk] A list of tracks.
*
* [extensions] You can add extend GPX by adding your own elements from another schema here.
*/
class GpxType(
val metadata: MetadataType,
val creator: String = "me.bvn13.sdk.android.gpx",
val wpt: List<WptType>? = null,
val rte: List<RteType>? = null,
val trk: List<TrkType>? = null,
val extensions: ExtensionType? = null
) {
val version: String = "1.1"
}

View File

@ -0,0 +1,212 @@
package me.bvn13.sdk.android.gpx
import me.bvn13.sdk.android.gpx.GpxWriter.Companion.DTF
import me.bvn13.sdk.android.gpx.GpxWriter.Companion.HEADER
import me.bvn13.sdk.android.gpx.GpxWriter.Companion.SCHEMA_LOCATION
import me.bvn13.sdk.android.gpx.GpxWriter.Companion.XMLNS
import me.bvn13.sdk.android.gpx.GpxWriter.Companion.XMLNS_XSI
import java.time.Clock
import java.time.OffsetDateTime
import java.time.format.DateTimeFormatter.ISO_LOCAL_DATE_TIME
import java.time.format.DateTimeFormatterBuilder
fun GpxType.toXmlString(): String = this.toXmlString(null)
fun GpxType.toXmlString(clock: Clock?): String = """
$HEADER
<gpx
xmlns="$XMLNS"
version="${this.version}"
creator="${this.creator}"
xmlns:xsi="$XMLNS_XSI"
xsi:schemaLocation="$SCHEMA_LOCATION">
<time>${now(clock)}</time>
${this.metadata.toXmlString()}
${this.wpt?.toXmlString()}
${this.rte?.toXmlString()}
${this.trk?.toXmlString()}
</gpx>
""".trim()
fun MetadataType.toXmlString(): String = """
<metadata>
<name>${this.name}</name>
<desc>${this.description}</desc>
<author>
<name>${this.authorName}</name>
</author>
</metadata>
""".trim()
private fun now(clock: Clock?) = OffsetDateTime.now(clock ?: Clock.systemDefaultZone()).format(DTF)
fun WptType.toXmlString(nodeName: String? = null) =
if (nodeName != null) {
this.toXmlString(nodeName)
} else {
this.toXmlString("wpt")
}
@JvmName("toXmlStringNamed")
fun WptType.toXmlString(nodeName: String) = """
<${nodeName} lat="${this.lat}" lon="${this.lon}">
${toXmlString(ele, "ele")}
${toXmlString(time, "time")}
${toXmlString(magvar, "magvar")}
${toXmlString(geoidheight, "geoidheight")}
${toXmlString(name, "name")}
${toXmlString(cmt, "cmt")}
${toXmlString(desc, "desc")}
${toXmlString(src, "src")}
${link?.toXmlString()}
${toXmlString(sym, "sym")}
${toXmlString(type, "type")}
${fix?.toXmlString()}
${toXmlString(sat, "sat")}
${toXmlString(hdop, "hdop")}
${toXmlString(vdop, "vdop")}
${toXmlString(pdop, "pdop")}
${toXmlString(ageofgpsdata, "ageofgpsdata")}
${toXmlString(dgpsid, "dgpsid")}
${extensions?.toXmlString()}
</${nodeName}>
""".trim()
fun RteType.toXmlString() = """
<rte>
${toXmlString(this.name, "name")}
${toXmlString(this.cmt, "cmt")}
${toXmlString(this.desc, "desc")}
${toXmlString(this.src, "src")}
${this.link?.toXmlString()}
${toXmlString(this.number, "number")}
${toXmlString(this.type, "type")}
${this.extensions?.toXmlString()}
${this.rtept?.toXmlString()}
</rte>
""".trim()
fun TrkType.toXmlString() = """
<trk>
${toXmlString(this.name, "name")}
${toXmlString(this.cmt, "cmt")}
${toXmlString(this.desc, "desc")}
${toXmlString(this.src, "src")}
${this.link?.toXmlString()}
${toXmlString(this.number, "number")}
${toXmlString(this.type, "type")}
${this.extensions?.toXmlString()}
${this.trkseg?.toXmlString()}
</trk>
""".trim()
fun List<WptType>.toXmlString(nodeName: String?) =
this.joinToString(prefix = "", postfix = "", separator = "") {
it.toXmlString(nodeName)
}
@JvmName("toXmlStringWptType")
fun List<WptType>.toXmlString() =
this.joinToString(prefix = "", postfix = "", separator = "") {
it.toXmlString()
}
@JvmName("toXmlStringLinkType")
fun List<LinkType>.toXmlString() =
this.joinToString(prefix = "", postfix = "", separator = "\n", transform = LinkType::toXmlString)
@JvmName("toXmlStringRteType")
fun List<RteType>.toXmlString() =
this.joinToString(prefix = "", postfix = "", separator = "", transform = RteType::toXmlString)
@JvmName("toXmlStringTrkType")
fun List<TrkType>.toXmlString() =
this.joinToString(prefix = "", postfix = "", separator = "", transform = TrkType::toXmlString)
@JvmName("toXmlStringTrksegType")
fun List<TrksegType>.toXmlString() =
this.joinToString(prefix = "", postfix = "", separator = "", transform = TrksegType::toXmlString)
fun List<ExtensionType>.toXmlString() =
this.joinToString(
prefix = "<extensions>\n",
postfix = "\n</extensions>",
separator = "\n",
transform = ExtensionType::toXmlString
)
fun LinkType.toXmlString() = """
<link href="${this.href}">
<text>${this.text}</text>
<type>${this.type}</type>
</link>
""".trim()
fun FixType.toXmlString() = """
<fix>${this.value}</fix>
""".trim()
fun ExtensionType.toXmlString() = """
<${this.nodeName}${toXmlString(this.parameters)}>${this.value ?: ""}</${this.nodeName}>
""".trim()
fun TrksegType.toXmlString() = """
<trkseg>
${this.trkpt?.toXmlString("trkpt")}
</trkseg>
""".trim()
fun toXmlString(value: String?, nodeName: String) =
if (value != null) {
"""
<${nodeName}>${value}</${nodeName}>
""".trim()
} else {
""
}
fun toXmlString(value: Int?, nodeName: String) =
if (value != null) {
"""
<${nodeName}>${value}</${nodeName}>
""".trim()
} else {
""
}
fun toXmlString(value: Double?, nodeName: String) =
if (value != null) {
"""
<${nodeName}>${value}</${nodeName}>
""".trim()
} else {
""
}
fun toXmlString(value: OffsetDateTime?, nodeName: String) =
if (value != null) {
"""
<${nodeName}>${value.format(DTF)}</${nodeName}>
""".trim()
} else {
""
}
fun toXmlString(value: Map<String, String>?) =
value?.entries?.joinToString(separator = "") {
" ${it.key}=\"${it.value}\""
} ?: ""
class GpxWriter {
companion object {
const val HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
const val XMLNS = "http://www.topografix.com/GPX/1/1"
const val XMLNS_XSI = "http://www.w3.org/2001/XMLSchema-instance"
const val SCHEMA_LOCATION = "http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"
internal val DTF = DateTimeFormatterBuilder()
.append(ISO_LOCAL_DATE_TIME) // use the existing formatter for date time
.appendOffset("+HH:MM", "+00:00") // set 'noOffsetText' to desired '+00:00'
.toFormatter()
}
}

View File

@ -0,0 +1,13 @@
package me.bvn13.sdk.android.gpx
/**
* A link to an external resource (Web page, digital photo, video clip, etc) with additional information.
*
* [href] URL of hyperlink.
*
* [text] Text of hyperlink.
*
* [type] Mime type of content (image/jpeg)
*/
class LinkType(val href: String, val text: String? = null, val type: String? = null) {
}

View File

@ -0,0 +1,8 @@
package me.bvn13.sdk.android.gpx
/**
* Information about the GPX file, author, and copyright restrictions goes in the metadata section.
* Providing rich, meaningful information about your GPX files allows others to search for and use your GPS data.
*/
class MetadataType(val name: String, val description: String = "", val authorName: String = "") {
}

View File

@ -0,0 +1,40 @@
package me.bvn13.sdk.android.gpx
/**
* rte represents route - an ordered list of waypoints representing a series of turn points leading to a destination.
*
* [namee] GPS name of track.
*
* [cmt] GPS comment for track.
*
* [desc] User description of track.
*
* [src] Source of data. Included to give user some idea of reliability and accuracy of data.
*
* [link] Links to external information about track.
*
* [number] GPS track number.
*
* [type] Type (classification) of track.
*
* [extensions] You can add extend GPX by adding your own elements from another schema here.
*
* [rtept] A list of route points.
*/
class RteType(
val name: String? = null,
val cmt: String? = null,
val desc: String? = null,
val src: String? = null,
val link: List<LinkType>? = null,
val number: Int? = null,
val type: String? = null,
val extensions: List<ExtensionType>? = null,
val rtept: List<WptType>? = null
) {
init {
require(number == null || number >= 0) {
"number must be non negative Integer"
}
}
}

View File

@ -0,0 +1,42 @@
package me.bvn13.sdk.android.gpx
/**
* trk represents a track - an ordered list of points describing a path.
*
* [namee] GPS name of route.
*
* [cmt] GPS comment for route.
*
* [desc] Text description of route for user. Not sent to GPS.
*
* [src] Source of data. Included to give user some idea of reliability and accuracy of data.
*
* [link] Links to external information about the route.
*
* [number] GPS route number.
*
* [type] Type (classification) of route.
*
* [extensions] You can add extend GPX by adding your own elements from another schema here.
*
* [trkseg] A Track Segment holds a list of Track Points which are logically connected in order.
* To represent a single GPS track where GPS reception was lost, or the GPS receiver was turned off,
* start a new Track Segment for each continuous span of track data
*/
class TrkType(
val name: String? = null,
val cmt: String? = null,
val desc: String? = null,
val src: String? = null,
val link: List<LinkType>? = null,
val number: Int? = null,
val type: String? = null,
val extensions: ExtensionType? = null,
val trkseg: List<TrksegType>? = null
) {
init {
require(number == null || number >= 0) {
"number must be non negative Integer"
}
}
}

View File

@ -0,0 +1,14 @@
package me.bvn13.sdk.android.gpx
/**
* A Track Segment holds a list of Track Points which are logically connected in order. To represent a single GPS track where GPS reception was lost, or the GPS receiver was turned off, start a new Track Segment for each continuous span of track data.
*
* [trkpt] A Track Point holds the coordinates, elevation, timestamp, and metadata for a single point in a track.
*
* [extensions] You can add extend GPX by adding your own elements from another schema here.
*/
class TrksegType(
val trkpt: List<WptType>? = null,
val extensions: ExtensionType? = null
) {
}

View File

@ -0,0 +1,88 @@
package me.bvn13.sdk.android.gpx
import java.time.OffsetDateTime
import java.time.ZonedDateTime
/**
* wpt represents a waypoint, point of interest, or named feature on a map.
*
* [lat] The latitude of the point. Decimal degrees
*
* [lon] The longitude of the point. Decimal degrees
*
* [ele] Elevation (in meters) of the point.
*
* [time] Creation/modification timestamp for element. Date and time in are in Univeral Coordinated Time (UTC), not local time!
* Conforms to ISO 8601 specification for date/time representation. Fractional seconds are allowed for millisecond timing in tracklogs.
*
* [magvar] Magnetic variation (in degrees) at the point
*
* [geoidheight] Height (in meters) of geoid (mean sea level) above WGS84 earth ellipsoid. As defined in NMEA GGA message.
*
* [name] The GPS name of the waypoint. This field will be transferred to and from the GPS. GPX does not place restrictions
* on the length of this field or the characters contained in it. It is up to the receiving application to validate the field before sending it to the GPS.
*
* [cmt] GPS waypoint comment. Sent to GPS as comment.
*
* [desc] A text description of the element. Holds additional information about the element intended for the user, not the GPS.
*
* [src] Source of data. Included to give user some idea of reliability and accuracy of data. "Garmin eTrex", "USGS quad Boston North", e.g.
*
* [link] Link to additional information about the waypoint.
*
* [sym] Text of GPS symbol name. For interchange with other programs, use the exact spelling of the symbol as displayed on the GPS.
* If the GPS abbreviates words, spell them out.
*
* [type] Type (classification) of the waypoint.
*
* [fix] Type of GPX fix.
*
* [sat] Number of satellites used to calculate the GPX fix.
*
* [hdop] Horizontal dilution of precision.
*
* [vdop] Vertical dilution of precision.
*
* [pdop] Position dilution of precision.
*
* [ageofgpsdata] Number of seconds since last DGPS update.
*
* [dgpsid] ID of DGPS station used in differential correction.
*
* [extensions] You can add extend GPX by adding your own elements from another schema here.
*/
class WptType(
val lat: Double,
val lon: Double,
val ele: Double? = null,
val time: OffsetDateTime? = null,
val magvar: Double? = null,
val geoidheight: Double? = null,
val name: String? = null,
val cmt: String? = null,
val desc: String? = null,
val src: String? = null,
val link: List<LinkType>? = null,
val sym: String? = null,
val type: String? = null,
val fix: FixType? = null,
val sat: Int? = null,
val hdop: Double? = null,
val vdop: Double? = null,
val pdop: Double? = null,
val ageofgpsdata: Int? = null,
val dgpsid: Int? = null,
val extensions: List<ExtensionType>? = null
) {
init {
require(sat == null || sat >= 0) {
"sat must be non-negative integer"
}
require(magvar == null || magvar in 0.0..360.0) {
"magvar must be degree in (0)..(360) in Double"
}
require(dgpsid in 0..1023) {
"dgpsid must be in 0..1023"
}
}
}

View File

@ -0,0 +1,333 @@
package me.bvn13.sdk.android.gpx
import io.kotest.core.spec.style.FunSpec
import java.time.*
import kotlin.test.assertEquals
class GpxWriterTest : FunSpec() {
init {
test("first test") {
val clock = Clock.fixed(
LocalDateTime.of(2022, 9, 24, 15, 4, 0, 0).toInstant(ZoneOffset.ofHours(3)), ZoneId.of("Europe/Moscow")
)
val gpxType = GpxType(
MetadataType("test name", description = "test description", authorName = "bvn13"),
wpt = listOf(
WptType(
lat = 14.64736838389662,
lon = 7.93212890625,
ele = 10.toDouble(),
time = OffsetDateTime.now(clock),
magvar = 3.toDouble(),
geoidheight = 45.toDouble(),
name = "test point 1",
cmt = "comment 1",
desc = "description of point 1",
link = listOf(
LinkType(
href = "http://link-to.site.href",
text = "text",
type = "hyperlink"
),
LinkType(
href = "http://link2-to.site.href",
text = "text2",
type = "hyperlink2"
)
),
src = "source 1",
sym = "sym 1",
type = "type 1",
fix = FixType.DGPS,
sat = 1,
hdop = 55.toDouble(),
vdop = 66.toDouble(),
pdop = 77.toDouble(),
ageofgpsdata = 44,
dgpsid = 88,
extensions = listOf(
ExtensionType(
"extension1",
parameters = mapOf(Pair("first", "second"), Pair("third", "fours"))
),
ExtensionType(
"extension2",
parameters = mapOf(Pair("aa", "bb"), Pair("cc", "dd"))
)
)
)
),
rte = listOf(
RteType(
name = "rte name",
cmt = "cmt",
desc = "desc",
src = "src",
link = listOf(
LinkType(
href = "https://new.link.rte",
text = "new text rte",
type = "hyperlink"
)
),
number = 1234,
type = "route",
extensions = listOf(
ExtensionType(
"ext-1",
value = "value1"
)
),
rtept = listOf(
WptType(
lat = 14.64736838389662,
lon = 7.93212890625,
ele = 10.toDouble(),
time = OffsetDateTime.now(clock),
magvar = 3.toDouble(),
geoidheight = 45.toDouble(),
name = "test point 1",
cmt = "comment 1",
desc = "description of point 1",
link = listOf(
LinkType(
href = "http://link-to.site.href",
text = "text",
type = "hyperlink"
),
LinkType(
href = "http://link2-to.site.href",
text = "text2",
type = "hyperlink2"
)
),
src = "source 1",
sym = "sym 1",
type = "type 1",
fix = FixType.DGPS,
sat = 1,
hdop = 55.toDouble(),
vdop = 66.toDouble(),
pdop = 77.toDouble(),
ageofgpsdata = 44,
dgpsid = 88,
extensions = listOf(
ExtensionType(
"extension1",
parameters = mapOf(Pair("first", "second"), Pair("third", "fours"))
),
ExtensionType(
"extension2",
parameters = mapOf(Pair("aa", "bb"), Pair("cc", "dd"))
)
)
)
)
)
),
trk = listOf(
TrkType(
name = "track 1",
cmt = "comment track 1",
desc = "desc track 1",
src = "src track 1",
number = 1234,
type = "type 1",
trkseg = listOf(
TrksegType(
listOf(
WptType(
lat = 14.64736838389662,
lon = 7.93212890625,
ele = 10.toDouble(),
time = OffsetDateTime.now(clock),
magvar = 3.toDouble(),
geoidheight = 45.toDouble(),
name = "test point 1",
cmt = "comment 1",
desc = "description of point 1",
link = listOf(
LinkType(
href = "http://link-to.site.href",
text = "text",
type = "hyperlink"
),
LinkType(
href = "http://link2-to.site.href",
text = "text2",
type = "hyperlink2"
)
),
src = "source 1",
sym = "sym 1",
type = "type 1",
fix = FixType.DGPS,
sat = 1,
hdop = 55.toDouble(),
vdop = 66.toDouble(),
pdop = 77.toDouble(),
ageofgpsdata = 44,
dgpsid = 88,
extensions = listOf(
ExtensionType(
"extension1",
parameters = mapOf(Pair("first", "second"), Pair("third", "fours"))
),
ExtensionType(
"extension2",
parameters = mapOf(Pair("aa", "bb"), Pair("cc", "dd"))
)
)
)
)
)
)
)
)
)
assertEquals(
"""
<?xml version="1.0" encoding="UTF-8"?>
<gpx
xmlns="http://www.topografix.com/GPX/1/1"
version="1.1"
creator="me.bvn13.sdk.android.gpx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
<time>2022-09-24T15:04:00+03:00</time>
<metadata>
<name>test name</name>
<desc>test description</desc>
<author>
<name>bvn13</name>
</author>
</metadata>
<wpt lat="14.64736838389662" lon="7.93212890625">
<ele>10.0</ele>
<time>2022-09-24T15:04:00+03:00</time>
<magvar>3.0</magvar>
<geoidheight>45.0</geoidheight>
<name>test point 1</name>
<cmt>comment 1</cmt>
<desc>description of point 1</desc>
<src>source 1</src>
<link href="http://link-to.site.href">
<text>text</text>
<type>hyperlink</type>
</link>
<link href="http://link2-to.site.href">
<text>text2</text>
<type>hyperlink2</type>
</link>
<sym>sym 1</sym>
<type>type 1</type>
<fix>dgps</fix>
<sat>1</sat>
<hdop>55.0</hdop>
<vdop>66.0</vdop>
<pdop>77.0</pdop>
<ageofgpsdata>44</ageofgpsdata>
<dgpsid>88</dgpsid>
<extensions>
<extension1 first="second" third="fours"></extension1>
<extension2 aa="bb" cc="dd"></extension2>
</extensions>
</wpt>
<rte>
<name>rte name</name>
<cmt>cmt</cmt>
<desc>desc</desc>
<src>src</src>
<link href="https://new.link.rte">
<text>new text rte</text>
<type>hyperlink</type>
</link>
<number>1234</number>
<type>route</type>
<extensions>
<ext-1>value1</ext-1>
</extensions>
<wpt lat="14.64736838389662" lon="7.93212890625">
<ele>10.0</ele>
<time>2022-09-24T15:04:00+03:00</time>
<magvar>3.0</magvar>
<geoidheight>45.0</geoidheight>
<name>test point 1</name>
<cmt>comment 1</cmt>
<desc>description of point 1</desc>
<src>source 1</src>
<link href="http://link-to.site.href">
<text>text</text>
<type>hyperlink</type>
</link>
<link href="http://link2-to.site.href">
<text>text2</text>
<type>hyperlink2</type>
</link>
<sym>sym 1</sym>
<type>type 1</type>
<fix>dgps</fix>
<sat>1</sat>
<hdop>55.0</hdop>
<vdop>66.0</vdop>
<pdop>77.0</pdop>
<ageofgpsdata>44</ageofgpsdata>
<dgpsid>88</dgpsid>
<extensions>
<extension1 first="second" third="fours"></extension1>
<extension2 aa="bb" cc="dd"></extension2>
</extensions>
</wpt>
</rte>
<trk>
<name>track 1</name>
<cmt>comment track 1</cmt>
<desc>desc track 1</desc>
<src>src track 1</src>
null
<number>1234</number>
<type>type 1</type>
null
<trkseg>
<trkpt lat="14.64736838389662" lon="7.93212890625">
<ele>10.0</ele>
<time>2022-09-24T15:04:00+03:00</time>
<magvar>3.0</magvar>
<geoidheight>45.0</geoidheight>
<name>test point 1</name>
<cmt>comment 1</cmt>
<desc>description of point 1</desc>
<src>source 1</src>
<link href="http://link-to.site.href">
<text>text</text>
<type>hyperlink</type>
</link>
<link href="http://link2-to.site.href">
<text>text2</text>
<type>hyperlink2</type>
</link>
<sym>sym 1</sym>
<type>type 1</type>
<fix>dgps</fix>
<sat>1</sat>
<hdop>55.0</hdop>
<vdop>66.0</vdop>
<pdop>77.0</pdop>
<ageofgpsdata>44</ageofgpsdata>
<dgpsid>88</dgpsid>
<extensions>
<extension1 first="second" third="fours"></extension1>
<extension2 aa="bb" cc="dd"></extension2>
</extensions>
</trkpt>
</trkseg>
</trk>
</gpx>
""".trim(),
gpxType.toXmlString(clock)
)
}
}
}

Binary file not shown.

View File

@ -0,0 +1,27 @@
# Created at 2022-09-23T16:36:51.955
org.apache.maven.surefire.util.SurefireReflectionException: java.lang.NoClassDefFoundError: org/junit/platform/commons/util/ClassNamePatternFilterUtils
at org.apache.maven.surefire.util.ReflectionUtils.instantiateOneArg(ReflectionUtils.java:139)
at org.apache.maven.surefire.booter.ForkedBooter.createProviderInCurrentClassloader(ForkedBooter.java:403)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:383)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345)
at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418)
Caused by: java.lang.NoClassDefFoundError: org/junit/platform/commons/util/ClassNamePatternFilterUtils
at org.junit.platform.launcher.core.LauncherFactory.loadAndFilterTestExecutionListeners(LauncherFactory.java:122)
at org.junit.platform.launcher.core.LauncherFactory.create(LauncherFactory.java:108)
at org.junit.platform.launcher.core.LauncherFactory.create(LauncherFactory.java:75)
at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.<init>(JUnitPlatformProvider.java:86)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.apache.maven.surefire.util.ReflectionUtils.instantiateOneArg(ReflectionUtils.java:135)
... 5 more
Caused by: java.lang.ClassNotFoundException: org.junit.platform.commons.util.ClassNamePatternFilterUtils
at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 14 more

View File

@ -0,0 +1,27 @@
# Created at 2022-09-24T12:12:29.669
org.apache.maven.surefire.util.SurefireReflectionException: java.lang.NoClassDefFoundError: org/junit/platform/commons/util/ClassNamePatternFilterUtils
at org.apache.maven.surefire.util.ReflectionUtils.instantiateOneArg(ReflectionUtils.java:139)
at org.apache.maven.surefire.booter.ForkedBooter.createProviderInCurrentClassloader(ForkedBooter.java:403)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:383)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345)
at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418)
Caused by: java.lang.NoClassDefFoundError: org/junit/platform/commons/util/ClassNamePatternFilterUtils
at org.junit.platform.launcher.core.LauncherFactory.loadAndFilterTestExecutionListeners(LauncherFactory.java:122)
at org.junit.platform.launcher.core.LauncherFactory.create(LauncherFactory.java:108)
at org.junit.platform.launcher.core.LauncherFactory.create(LauncherFactory.java:75)
at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.<init>(JUnitPlatformProvider.java:86)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.apache.maven.surefire.util.ReflectionUtils.instantiateOneArg(ReflectionUtils.java:135)
... 5 more
Caused by: java.lang.ClassNotFoundException: org.junit.platform.commons.util.ClassNamePatternFilterUtils
at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 14 more

View File

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report.xsd" name="me.bvn13.sdk.android.gpx.GpxWriterTest" time="0.205" tests="1" errors="0" skipped="0" failures="0">
<properties>
<property name="awt.toolkit" value="sun.awt.X11.XToolkit"/>
<property name="file.encoding.pkg" value="sun.io"/>
<property name="java.specification.version" value="1.8"/>
<property name="sun.cpu.isalist" value=""/>
<property name="sun.jnu.encoding" value="UTF-8"/>
<property name="java.class.path" value="/home/bvn13/develop/GpxAndroidSdk/GpxAndroidSdk/target/test-classes:/home/bvn13/develop/GpxAndroidSdk/GpxAndroidSdk/target/classes:/home/bvn13/.m2/repository/org/jetbrains/kotlin/kotlin-test-junit5/1.7.10/kotlin-test-junit5-1.7.10.jar:/home/bvn13/.m2/repository/org/jetbrains/kotlin/kotlin-test/1.7.10/kotlin-test-1.7.10.jar:/home/bvn13/.m2/repository/org/junit/jupiter/junit-jupiter-engine/5.8.2/junit-jupiter-engine-5.8.2.jar:/home/bvn13/.m2/repository/org/junit/platform/junit-platform-engine/1.8.2/junit-platform-engine-1.8.2.jar:/home/bvn13/.m2/repository/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar:/home/bvn13/.m2/repository/org/junit/jupiter/junit-jupiter-api/5.8.2/junit-jupiter-api-5.8.2.jar:/home/bvn13/.m2/repository/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar:/home/bvn13/.m2/repository/org/junit/platform/junit-platform-commons/1.8.2/junit-platform-commons-1.8.2.jar:/home/bvn13/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.7.10/kotlin-stdlib-jdk8-1.7.10.jar:/home/bvn13/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib/1.7.10/kotlin-stdlib-1.7.10.jar:/home/bvn13/.m2/repository/org/jetbrains/annotations/13.0/annotations-13.0.jar:/home/bvn13/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.7.10/kotlin-stdlib-jdk7-1.7.10.jar:/home/bvn13/.m2/repository/io/kotest/kotest-runner-junit5-jvm/5.4.2/kotest-runner-junit5-jvm-5.4.2.jar:/home/bvn13/.m2/repository/io/kotest/kotest-framework-api-jvm/5.4.2/kotest-framework-api-jvm-5.4.2.jar:/home/bvn13/.m2/repository/org/jetbrains/kotlinx/kotlinx-coroutines-test-jvm/1.6.4/kotlinx-coroutines-test-jvm-1.6.4.jar:/home/bvn13/.m2/repository/io/kotest/kotest-common-jvm/5.4.2/kotest-common-jvm-5.4.2.jar:/home/bvn13/.m2/repository/io/kotest/kotest-framework-engine-jvm/5.4.2/kotest-framework-engine-jvm-5.4.2.jar:/home/bvn13/.m2/repository/io/github/classgraph/classgraph/4.8.149/classgraph-4.8.149.jar:/home/bvn13/.m2/repository/com/github/ajalt/mordant/1.2.1/mordant-1.2.1.jar:/home/bvn13/.m2/repository/com/github/ajalt/colormath/1.2.0/colormath-1.2.0.jar:/home/bvn13/.m2/repository/org/jetbrains/kotlinx/kotlinx-coroutines-debug/1.6.4/kotlinx-coroutines-debug-1.6.4.jar:/home/bvn13/.m2/repository/net/java/dev/jna/jna/5.9.0/jna-5.9.0.jar:/home/bvn13/.m2/repository/net/java/dev/jna/jna-platform/5.9.0/jna-platform-5.9.0.jar:/home/bvn13/.m2/repository/net/bytebuddy/byte-buddy/1.10.9/byte-buddy-1.10.9.jar:/home/bvn13/.m2/repository/net/bytebuddy/byte-buddy-agent/1.10.9/byte-buddy-agent-1.10.9.jar:/home/bvn13/.m2/repository/io/kotest/kotest-framework-discovery-jvm/5.4.2/kotest-framework-discovery-jvm-5.4.2.jar:/home/bvn13/.m2/repository/io/kotest/kotest-extensions-jvm/5.4.2/kotest-extensions-jvm-5.4.2.jar:/home/bvn13/.m2/repository/commons-io/commons-io/2.11.0/commons-io-2.11.0.jar:/home/bvn13/.m2/repository/io/mockk/mockk/1.12.5/mockk-1.12.5.jar:/home/bvn13/.m2/repository/io/mockk/mockk-common/1.12.5/mockk-common-1.12.5.jar:/home/bvn13/.m2/repository/io/mockk/mockk-dsl/1.12.5/mockk-dsl-1.12.5.jar:/home/bvn13/.m2/repository/io/mockk/mockk-dsl-jvm/1.12.5/mockk-dsl-jvm-1.12.5.jar:/home/bvn13/.m2/repository/io/mockk/mockk-agent-jvm/1.12.5/mockk-agent-jvm-1.12.5.jar:/home/bvn13/.m2/repository/io/mockk/mockk-agent-api/1.12.5/mockk-agent-api-1.12.5.jar:/home/bvn13/.m2/repository/io/mockk/mockk-agent-common/1.12.5/mockk-agent-common-1.12.5.jar:/home/bvn13/.m2/repository/org/objenesis/objenesis/3.2/objenesis-3.2.jar:/home/bvn13/.m2/repository/io/kotest/kotest-framework-concurrency-jvm/5.4.2/kotest-framework-concurrency-jvm-5.4.2.jar:/home/bvn13/.m2/repository/org/jetbrains/kotlinx/kotlinx-coroutines-core-jvm/1.6.4/kotlinx-coroutines-core-jvm-1.6.4.jar:/home/bvn13/.m2/repository/org/junit/platform/junit-platform-suite-api/1.7.2/junit-platform-suite-api-1.7.2.jar:/home/bvn13/.m2/repository/org/junit/platform/junit-platform-launcher/1.7.2/junit-platform-launcher-1.7.2.jar:/home/bvn13/.m2/repository/org/jetbrains/kotlin/kotlin-reflect/1.6.21/kotlin-reflect-1.6.21.jar:/home/bvn13/.m2/repository/io/kotest/kotest-assertions-core-jvm/5.4.2/kotest-assertions-core-jvm-5.4.2.jar:/home/bvn13/.m2/repository/io/kotest/kotest-assertions-shared-jvm/5.4.2/kotest-assertions-shared-jvm-5.4.2.jar:/home/bvn13/.m2/repository/io/github/java-diff-utils/java-diff-utils/4.12/java-diff-utils-4.12.jar:/home/bvn13/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib-common/1.6.21/kotlin-stdlib-common-1.6.21.jar:/home/bvn13/.m2/repository/org/jetbrains/kotlinx/kotlinx-coroutines-jdk8/1.6.4/kotlinx-coroutines-jdk8-1.6.4.jar:/home/bvn13/.m2/repository/io/kotest/kotest-assertions-api-jvm/5.4.2/kotest-assertions-api-jvm-5.4.2.jar:"/>
<property name="java.vm.vendor" value="Red Hat, Inc."/>
<property name="sun.arch.data.model" value="64"/>
<property name="java.vendor.url" value="https://www.redhat.com/"/>
<property name="user.timezone" value=""/>
<property name="java.vm.specification.version" value="1.8"/>
<property name="os.name" value="Linux"/>
<property name="user.country" value="US"/>
<property name="sun.java.launcher" value="SUN_STANDARD"/>
<property name="sun.boot.library.path" value="/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.345.b01-1.fc36.x86_64/jre/lib/amd64"/>
<property name="sun.java.command" value="/home/bvn13/develop/GpxAndroidSdk/GpxAndroidSdk/target/surefire/surefirebooter2288107061283020216.jar /home/bvn13/develop/GpxAndroidSdk/GpxAndroidSdk/target/surefire 2022-09-25T00-07-02_516-jvmRun1 surefire3935311203097038928tmp surefire_07135688762883208761tmp"/>
<property name="surefire.test.class.path" value="/home/bvn13/develop/GpxAndroidSdk/GpxAndroidSdk/target/test-classes:/home/bvn13/develop/GpxAndroidSdk/GpxAndroidSdk/target/classes:/home/bvn13/.m2/repository/org/jetbrains/kotlin/kotlin-test-junit5/1.7.10/kotlin-test-junit5-1.7.10.jar:/home/bvn13/.m2/repository/org/jetbrains/kotlin/kotlin-test/1.7.10/kotlin-test-1.7.10.jar:/home/bvn13/.m2/repository/org/junit/jupiter/junit-jupiter-engine/5.8.2/junit-jupiter-engine-5.8.2.jar:/home/bvn13/.m2/repository/org/junit/platform/junit-platform-engine/1.8.2/junit-platform-engine-1.8.2.jar:/home/bvn13/.m2/repository/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar:/home/bvn13/.m2/repository/org/junit/jupiter/junit-jupiter-api/5.8.2/junit-jupiter-api-5.8.2.jar:/home/bvn13/.m2/repository/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar:/home/bvn13/.m2/repository/org/junit/platform/junit-platform-commons/1.8.2/junit-platform-commons-1.8.2.jar:/home/bvn13/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.7.10/kotlin-stdlib-jdk8-1.7.10.jar:/home/bvn13/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib/1.7.10/kotlin-stdlib-1.7.10.jar:/home/bvn13/.m2/repository/org/jetbrains/annotations/13.0/annotations-13.0.jar:/home/bvn13/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.7.10/kotlin-stdlib-jdk7-1.7.10.jar:/home/bvn13/.m2/repository/io/kotest/kotest-runner-junit5-jvm/5.4.2/kotest-runner-junit5-jvm-5.4.2.jar:/home/bvn13/.m2/repository/io/kotest/kotest-framework-api-jvm/5.4.2/kotest-framework-api-jvm-5.4.2.jar:/home/bvn13/.m2/repository/org/jetbrains/kotlinx/kotlinx-coroutines-test-jvm/1.6.4/kotlinx-coroutines-test-jvm-1.6.4.jar:/home/bvn13/.m2/repository/io/kotest/kotest-common-jvm/5.4.2/kotest-common-jvm-5.4.2.jar:/home/bvn13/.m2/repository/io/kotest/kotest-framework-engine-jvm/5.4.2/kotest-framework-engine-jvm-5.4.2.jar:/home/bvn13/.m2/repository/io/github/classgraph/classgraph/4.8.149/classgraph-4.8.149.jar:/home/bvn13/.m2/repository/com/github/ajalt/mordant/1.2.1/mordant-1.2.1.jar:/home/bvn13/.m2/repository/com/github/ajalt/colormath/1.2.0/colormath-1.2.0.jar:/home/bvn13/.m2/repository/org/jetbrains/kotlinx/kotlinx-coroutines-debug/1.6.4/kotlinx-coroutines-debug-1.6.4.jar:/home/bvn13/.m2/repository/net/java/dev/jna/jna/5.9.0/jna-5.9.0.jar:/home/bvn13/.m2/repository/net/java/dev/jna/jna-platform/5.9.0/jna-platform-5.9.0.jar:/home/bvn13/.m2/repository/net/bytebuddy/byte-buddy/1.10.9/byte-buddy-1.10.9.jar:/home/bvn13/.m2/repository/net/bytebuddy/byte-buddy-agent/1.10.9/byte-buddy-agent-1.10.9.jar:/home/bvn13/.m2/repository/io/kotest/kotest-framework-discovery-jvm/5.4.2/kotest-framework-discovery-jvm-5.4.2.jar:/home/bvn13/.m2/repository/io/kotest/kotest-extensions-jvm/5.4.2/kotest-extensions-jvm-5.4.2.jar:/home/bvn13/.m2/repository/commons-io/commons-io/2.11.0/commons-io-2.11.0.jar:/home/bvn13/.m2/repository/io/mockk/mockk/1.12.5/mockk-1.12.5.jar:/home/bvn13/.m2/repository/io/mockk/mockk-common/1.12.5/mockk-common-1.12.5.jar:/home/bvn13/.m2/repository/io/mockk/mockk-dsl/1.12.5/mockk-dsl-1.12.5.jar:/home/bvn13/.m2/repository/io/mockk/mockk-dsl-jvm/1.12.5/mockk-dsl-jvm-1.12.5.jar:/home/bvn13/.m2/repository/io/mockk/mockk-agent-jvm/1.12.5/mockk-agent-jvm-1.12.5.jar:/home/bvn13/.m2/repository/io/mockk/mockk-agent-api/1.12.5/mockk-agent-api-1.12.5.jar:/home/bvn13/.m2/repository/io/mockk/mockk-agent-common/1.12.5/mockk-agent-common-1.12.5.jar:/home/bvn13/.m2/repository/org/objenesis/objenesis/3.2/objenesis-3.2.jar:/home/bvn13/.m2/repository/io/kotest/kotest-framework-concurrency-jvm/5.4.2/kotest-framework-concurrency-jvm-5.4.2.jar:/home/bvn13/.m2/repository/org/jetbrains/kotlinx/kotlinx-coroutines-core-jvm/1.6.4/kotlinx-coroutines-core-jvm-1.6.4.jar:/home/bvn13/.m2/repository/org/junit/platform/junit-platform-suite-api/1.7.2/junit-platform-suite-api-1.7.2.jar:/home/bvn13/.m2/repository/org/junit/platform/junit-platform-launcher/1.7.2/junit-platform-launcher-1.7.2.jar:/home/bvn13/.m2/repository/org/jetbrains/kotlin/kotlin-reflect/1.6.21/kotlin-reflect-1.6.21.jar:/home/bvn13/.m2/repository/io/kotest/kotest-assertions-core-jvm/5.4.2/kotest-assertions-core-jvm-5.4.2.jar:/home/bvn13/.m2/repository/io/kotest/kotest-assertions-shared-jvm/5.4.2/kotest-assertions-shared-jvm-5.4.2.jar:/home/bvn13/.m2/repository/io/github/java-diff-utils/java-diff-utils/4.12/java-diff-utils-4.12.jar:/home/bvn13/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib-common/1.6.21/kotlin-stdlib-common-1.6.21.jar:/home/bvn13/.m2/repository/org/jetbrains/kotlinx/kotlinx-coroutines-jdk8/1.6.4/kotlinx-coroutines-jdk8-1.6.4.jar:/home/bvn13/.m2/repository/io/kotest/kotest-assertions-api-jvm/5.4.2/kotest-assertions-api-jvm-5.4.2.jar:"/>
<property name="sun.cpu.endian" value="little"/>
<property name="user.home" value="/home/bvn13"/>
<property name="user.language" value="en"/>
<property name="java.specification.vendor" value="Oracle Corporation"/>
<property name="java.home" value="/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.345.b01-1.fc36.x86_64/jre"/>
<property name="basedir" value="/home/bvn13/develop/GpxAndroidSdk/GpxAndroidSdk"/>
<property name="file.separator" value="/"/>
<property name="line.separator" value="&#10;"/>
<property name="java.vm.specification.vendor" value="Oracle Corporation"/>
<property name="java.specification.name" value="Java Platform API Specification"/>
<property name="java.awt.graphicsenv" value="sun.awt.X11GraphicsEnvironment"/>
<property name="surefire.real.class.path" value="/home/bvn13/develop/GpxAndroidSdk/GpxAndroidSdk/target/surefire/surefirebooter2288107061283020216.jar"/>
<property name="sun.boot.class.path" value="/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.345.b01-1.fc36.x86_64/jre/lib/resources.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.345.b01-1.fc36.x86_64/jre/lib/rt.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.345.b01-1.fc36.x86_64/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.345.b01-1.fc36.x86_64/jre/lib/jsse.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.345.b01-1.fc36.x86_64/jre/lib/jce.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.345.b01-1.fc36.x86_64/jre/lib/charsets.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.345.b01-1.fc36.x86_64/jre/lib/jfr.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.345.b01-1.fc36.x86_64/jre/classes"/>
<property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/>
<property name="java.runtime.version" value="1.8.0_345-b01"/>
<property name="user.name" value="bvn13"/>
<property name="path.separator" value=":"/>
<property name="os.version" value="5.19.9-200.fc36.x86_64"/>
<property name="java.endorsed.dirs" value="/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.345.b01-1.fc36.x86_64/jre/lib/endorsed"/>
<property name="java.runtime.name" value="OpenJDK Runtime Environment"/>
<property name="file.encoding" value="UTF-8"/>
<property name="java.vm.name" value="OpenJDK 64-Bit Server VM"/>
<property name="localRepository" value="/home/bvn13/.m2/repository"/>
<property name="java.vendor.url.bug" value="https://bugzilla.redhat.com/enter_bug.cgi?product=Fedora&amp;component=java-1.8.0-openjdk&amp;version=36"/>
<property name="java.io.tmpdir" value="/tmp"/>
<property name="idea.version" value="2022.2.1"/>
<property name="java.version" value="1.8.0_345"/>
<property name="user.dir" value="/home/bvn13/develop/GpxAndroidSdk/GpxAndroidSdk"/>
<property name="os.arch" value="amd64"/>
<property name="java.vm.specification.name" value="Java Virtual Machine Specification"/>
<property name="java.awt.printerjob" value="sun.print.PSPrinterJob"/>
<property name="sun.os.patch.level" value="unknown"/>
<property name="java.library.path" value="/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib"/>
<property name="java.vm.info" value="mixed mode"/>
<property name="java.vendor" value="Red Hat, Inc."/>
<property name="java.vm.version" value="25.345-b01"/>
<property name="java.ext.dirs" value="/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.345.b01-1.fc36.x86_64/jre/lib/ext:/usr/java/packages/lib/ext"/>
<property name="sun.io.unicode.encoding" value="UnicodeLittle"/>
<property name="java.class.version" value="52.0"/>
</properties>
<testcase name="first test" classname="me.bvn13.sdk.android.gpx.GpxWriterTest" time="0.105"/>
</testsuite>

View File

@ -0,0 +1,4 @@
-------------------------------------------------------------------------------
Test set: me.bvn13.sdk.android.gpx.GpxWriterTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.205 s - in me.bvn13.sdk.android.gpx.GpxWriterTest