This is an automated email from the ASF dual-hosted git repository. sebb pushed a commit to branch jartests in repository https://gitbox.apache.org/repos/asf/commons-net.git
commit 64ae361900572ab4dfb67de6f8cec89de1f66e83 Author: Sebb <[email protected]> AuthorDate: Tue May 7 11:09:45 2024 +0100 Test against released jars --- .github/workflows/maven_adhoc.yml | 42 ++++++++++++++++++++++ .gitignore | 1 + pom.xml | 40 +++++++++++++++++++++ .../net/ftp/parser/FTPTimestampNET710Test.java | 27 ++++++++++++++ 4 files changed, 110 insertions(+) diff --git a/.github/workflows/maven_adhoc.yml b/.github/workflows/maven_adhoc.yml new file mode 100644 index 00000000..07cbf618 --- /dev/null +++ b/.github/workflows/maven_adhoc.yml @@ -0,0 +1,42 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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 +# +# http://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. + +name: Java CI adhoc testing + +on: workflow_dispatch + +permissions: + contents: read + +jobs: + build: + timeout-minutes: 7 + continue-on-error: true + strategy: + matrix: + tag: [ 3.10.0, 3.9.0, 3.8.0, 3.7.0 ] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 + with: + persist-credentials: false + - name: Set up JDK + uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 + with: + distribution: 'temurin' + java-version: 8 + - name: Test NET710 + run: | + mvn -V --batch-mode --file pom.xml --no-transfer-progress test -Dnet.version=${{ matrix.tag }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..9f970225 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +target/ \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 00000000..20d0c6a8 --- /dev/null +++ b/pom.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + 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> + + <groupId>org.apache.commons</groupId> + <artifactId>net-jartests</artifactId> + <version>1.0-SNAPSHOT</version> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <maven.compiler.source>1.8</maven.compiler.source> + <maven.compiler.target>${maven.compiler.source}</maven.compiler.target> + <net.version>3.10.0</net.version> + </properties> + + <dependencies> + <dependency> + <groupId>commons-net</groupId> + <artifactId>commons-net</artifactId> + <version>${net.version}</version> + </dependency> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter</artifactId> + <version>5.10.2</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <version>3.2.5</version> + </plugin> + </plugins> + </build> + +</project> diff --git a/src/test/java/org/apache/commons/net/ftp/parser/FTPTimestampNET710Test.java b/src/test/java/org/apache/commons/net/ftp/parser/FTPTimestampNET710Test.java new file mode 100644 index 00000000..8de21d3d --- /dev/null +++ b/src/test/java/org/apache/commons/net/ftp/parser/FTPTimestampNET710Test.java @@ -0,0 +1,27 @@ +package org.apache.commons.net.ftp.parser; + + +import java.text.ParseException; +import java.util.Calendar; +import java.util.Locale; +import java.util.TimeZone; + +import org.junit.jupiter.api.Test; + +/** +* Test NET710 +*/ +public class FTPTimestampNET710Test { + + @Test + public void testNet710() throws ParseException { + FTPTimestampParserImpl parser = new FTPTimestampParserImpl(); + Class<?> klass = FTPTimestampParserImpl.class; + System.out.println(klass.getResource('/' + klass.getName().replace('.', '/') + ".class")); + Calendar serverTime = Calendar.getInstance(TimeZone.getTimeZone("EDT"), Locale.US); + serverTime.set(2022, 2, 16, 14, 0); + Calendar p = parser.parseTimestamp("Mar 13 02:33", serverTime); + System.out.println(p); + } + +}
