From c0fb1a95432ed4978f9bf08842ecac2b9d5f2f63 Mon Sep 17 00:00:00 2001 From: Adam Kewley Date: Tue, 5 Dec 2017 19:29:35 +0000 Subject: [PATCH 01/11] Updated travis CI to automatically produce a release when a tagged version is made --- .travis.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.travis.yml b/.travis.yml index da806fa..c7ad1de 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,27 @@ language: java + branches: only: - master + - dev + - /\d+.\d+.\d+/ # tagged versions + - /\d+.\d+.\d+-staging/ # staging area for tagged releases + +before_deploy: +- gem install fpm # install gem for creating OS packages +- bash packaging/make-deb-pkg.sh $TRAVIS_TAG # build OS packages + +deploy: + provider: releases + api_key: + secure: SI69iJp/8r8DhGxHmh7rqCpqDPbtPfQr26Zvk9cDDswVgIcziwUAD1M0oBCFT7TxERupg5N7Nf11vYN5g7TXPhIP6UXwGNnM2nGqTQp6K4vnvgrJk5ZdtKti97eVTDYlxZj363sZ9Mmn+pPYiiuQzqk7NzfjW2f0P2DXhWgIjgAioMopYF1cMxUN2pQ6NEH6UzNK0sT064A0JpYulIOi9EWhWgAiagsvk2mxvjcvQfyvJooSYU+DPEoDQN8Ly7Xe2PXXNnDeWFgTczcEoIGaAzJtVK6DFfbGq17BIcHh3e8Dy5Qjf4mAWUxY0BmVV4ZIDR5/v08rSGS4Su/vlg/LxNt0cWj1KPXPlWSqzyVGSZV1qDfXGqf7/KE8xM+WQpZLZUSgV3LNsitAjJ3X/0wepdPHniwJXj+vcCfoRd4KZcsKT5wLkSAQwh3smxZ6qEBIumFp6WHNs2nEL/T0cCx9Uw7hFSAMIe9ObSaEK3WecMF9rbX1opYqdPveQsNM4SSQ6k2f4lGOjX0bOWcBZlnkcrXOkEHxP/G40ng/V75wQEP9N2r4EMgcLMp+64pG2zg8suDZtx0nXxWQfD9PRcvuFtgpxNQ80DxgLkq53ju/afVsepeAInPL+NcFJPZPYgTjhBf4GIjuCTZFXk2rpraueYGk++brCPvJtnehdQjIkio= + + skip_cleanup: true + + file: + - target/jobson_${TRAVIS_TAG}_amd64.deb + - target/jobson-${TRAVIS_TAG}-bin.tar.gz + + on: + tags: true + From eabd16b1e2ec103372f08c0eef5b5fba6ab5812b Mon Sep 17 00:00:00 2001 From: Adam Kewley Date: Tue, 5 Dec 2017 20:15:00 +0000 Subject: [PATCH 02/11] Added support for testing the top-level CLI as a separate process --- .../systemtests/commands/CliHelpers.java | 69 +++++++++++++++++++ .../systemtests/commands/NewCommandTest.java | 67 ++++++++++++++++++ .../commands/ValidateCommandTest.java | 37 ++++++++++ 3 files changed, 173 insertions(+) create mode 100644 src/test/java/com/github/jobson/systemtests/commands/CliHelpers.java create mode 100644 src/test/java/com/github/jobson/systemtests/commands/NewCommandTest.java create mode 100644 src/test/java/com/github/jobson/systemtests/commands/ValidateCommandTest.java diff --git a/src/test/java/com/github/jobson/systemtests/commands/CliHelpers.java b/src/test/java/com/github/jobson/systemtests/commands/CliHelpers.java new file mode 100644 index 0000000..a5b6de3 --- /dev/null +++ b/src/test/java/com/github/jobson/systemtests/commands/CliHelpers.java @@ -0,0 +1,69 @@ +/* + * 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. + */ + + +package com.github.jobson.systemtests.commands; + +import com.github.jobson.App; + +import java.io.File; +import java.io.IOException; +import java.net.URL; +import java.net.URLClassLoader; +import java.nio.file.Files; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +public final class CliHelpers { + + public static int run(String... args) throws IOException, InterruptedException { + final File pwd = Files.createTempDirectory(CliHelpers.class.getSimpleName()).toFile(); + return run(pwd, args); + } + + public static int run(File pwd, String... args) throws IOException, InterruptedException { + final Process process = new ProcessBuilder(getAllArgs(Arrays.asList(args))) + .inheritIO() + .directory(pwd) + .start(); + + return process.waitFor(); + } + + private static List getAllArgs(List extraArgs) { + final List processArgs = new ArrayList<>(); + + processArgs.add(System.getProperty("java.home") + "/bin/java"); + processArgs.add("-classpath"); + processArgs.add(reconstructClasspath()); + processArgs.add(App.class.getCanonicalName()); + + processArgs.addAll(extraArgs); + + return processArgs; + } + + private static String reconstructClasspath() { + return Arrays.stream(((URLClassLoader) Thread.currentThread().getContextClassLoader()).getURLs()) + .map(URL::getFile) + .collect(Collectors.joining(File.pathSeparator)); + } +} diff --git a/src/test/java/com/github/jobson/systemtests/commands/NewCommandTest.java b/src/test/java/com/github/jobson/systemtests/commands/NewCommandTest.java new file mode 100644 index 0000000..c71e444 --- /dev/null +++ b/src/test/java/com/github/jobson/systemtests/commands/NewCommandTest.java @@ -0,0 +1,67 @@ +/* + * 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. + */ + + +package com.github.jobson.systemtests.commands; + +import com.github.jobson.Constants; +import org.junit.Test; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; + +import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat; + +public final class NewCommandTest { + + @Test + public void testCanRunNewCommand() throws IOException, InterruptedException { + final Path pwd = Files.createTempDirectory(NewCommandTest.class.getSimpleName()); + final int exitCode = CliHelpers.run(pwd.toFile(), "new"); + + assertThat(exitCode).isEqualTo(0); + assertThat(Files.exists(pwd.resolve(Constants.WORKSPACE_SPECS_DIRNAME))); + assertThat(Files.exists(pwd.resolve(Constants.WORKSPACE_CONFIG_FILENAME))); + assertThat(Files.exists(pwd.resolve(Constants.WORKSPACE_USER_FILENAME))); + assertThat(Files.exists(pwd.resolve(Constants.WORKSPACE_JOBS_DIRNAME))); + assertThat(Files.exists(pwd.resolve(Constants.WORKSPACE_WDS_DIRNAME))); + } + + @Test + public void testRunningNewCommandWithDemoProducesADemoSpec() throws IOException, InterruptedException { + final Path pwd = Files.createTempDirectory(NewCommandTest.class.getSimpleName()); + final int exitCode = CliHelpers.run(pwd.toFile(), "new", "--demo"); + + assertThat(exitCode).isEqualTo(0); + assertThat(Files.exists(pwd.resolve(Constants.WORKSPACE_SPECS_DIRNAME).resolve(Constants.DEMO_SPEC_DIRNAME))); + } + + @Test + public void testRunningNewCommandWithDemoProducesASpecThatIsValid() throws IOException, InterruptedException { + final Path pwd = Files.createTempDirectory(NewCommandTest.class.getSimpleName()); + final int exitCode = CliHelpers.run(pwd.toFile(), "new", "--demo"); + + assertThat(exitCode).isEqualTo(0); + + final int validationExitCode = CliHelpers.run(pwd.toFile(), "validate", "spec", Constants.DEMO_SPEC_DIRNAME); + + assertThat(validationExitCode).isEqualTo(0); + } +} diff --git a/src/test/java/com/github/jobson/systemtests/commands/ValidateCommandTest.java b/src/test/java/com/github/jobson/systemtests/commands/ValidateCommandTest.java new file mode 100644 index 0000000..4f34611 --- /dev/null +++ b/src/test/java/com/github/jobson/systemtests/commands/ValidateCommandTest.java @@ -0,0 +1,37 @@ +/* + * 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. + */ + + +package com.github.jobson.systemtests.commands; + +import org.junit.Test; + +import java.io.IOException; + +import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat; + +public final class ValidateCommandTest { + + @Test + public void testCallingValidateCommandHelpReturnsExitCode0() throws IOException, InterruptedException { + final int exitCode = CliHelpers.run("validate", "--help"); + + assertThat(exitCode).isEqualTo(0); + } +} From 045d74f1e9f219e65a9229f85c8e7a10d2361e6c Mon Sep 17 00:00:00 2001 From: Adam Kewley Date: Tue, 5 Dec 2017 20:30:51 +0000 Subject: [PATCH 03/11] Added support for command-line tests --- .../ResolvedPersistedJobRequestTest.java | 2 +- .../java/com/github/jobson/TestHelpers.java | 12 ++-- .../dao/jobs/FilesystemJobsDAOTest.java | 12 +--- .../github/jobson/dao/jobs/JobsDAOTest.java | 8 +-- .../dao/specs/FilesystemJobSpecDAOTest.java | 3 +- .../fixtures/PersistedJobRequestFixture.java | 2 +- .../jobs/execution/JobExecutorTest.java | 2 +- .../jobs/management/JobManagerTest.java | 6 +- .../management/MockInMemoryJobWriter.java | 3 +- .../jobs/management/MockJobExecutor.java | 2 +- .../jobson/resources/v1/JobResourceTest.java | 14 ++--- .../resources/v1/JobSpecResourceTest.java | 2 +- .../systemtests/commands/RunCommandTest.java | 60 +++++++++++++++++++ .../commands/ValidateCommandTest.java | 15 +++++ .../systemtests/httpapi/TestJobsAPI.java | 1 - .../systemtests/httpapi/TestUsersAPI.java | 1 - .../systemtests/commands/trivial-spec.yml | 9 +++ 17 files changed, 112 insertions(+), 42 deletions(-) create mode 100644 src/test/java/com/github/jobson/systemtests/commands/RunCommandTest.java create mode 100644 src/test/resources/fixtures/systemtests/commands/trivial-spec.yml diff --git a/src/test/java/com/github/jobson/ResolvedPersistedJobRequestTest.java b/src/test/java/com/github/jobson/ResolvedPersistedJobRequestTest.java index 8bacce2..52f4426 100644 --- a/src/test/java/com/github/jobson/ResolvedPersistedJobRequestTest.java +++ b/src/test/java/com/github/jobson/ResolvedPersistedJobRequestTest.java @@ -21,7 +21,6 @@ import com.fasterxml.jackson.databind.JsonNode; import com.github.jobson.api.v1.APIJobRequest; -import com.github.jobson.specs.JobSpecId; import com.github.jobson.api.v1.UserId; import com.github.jobson.jobinputs.JobExpectedInput; import com.github.jobson.jobinputs.JobExpectedInputId; @@ -31,6 +30,7 @@ import com.github.jobson.jobs.jobstates.ValidJobRequest; import com.github.jobson.specs.ExecutionConfiguration; import com.github.jobson.specs.JobSpec; +import com.github.jobson.specs.JobSpecId; import com.github.jobson.utils.Either; import com.github.jobson.utils.ValidationError; import org.junit.Test; diff --git a/src/test/java/com/github/jobson/TestHelpers.java b/src/test/java/com/github/jobson/TestHelpers.java index 78b8093..d4fae85 100644 --- a/src/test/java/com/github/jobson/TestHelpers.java +++ b/src/test/java/com/github/jobson/TestHelpers.java @@ -23,11 +23,11 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; -import com.github.jobson.api.v1.*; -import com.github.jobson.dao.jobs.JobOutputDetails; -import com.github.jobson.jobs.JobOutput; -import com.github.jobson.utils.BinaryData; +import com.github.jobson.api.v1.APIJobDetails; +import com.github.jobson.api.v1.APIJobRequest; +import com.github.jobson.api.v1.UserId; import com.github.jobson.dao.jobs.JobDetails; +import com.github.jobson.dao.jobs.JobOutputDetails; import com.github.jobson.dao.specs.JobSpecSummary; import com.github.jobson.dao.users.UserCredentials; import com.github.jobson.fixtures.ValidJobRequestFixture; @@ -42,11 +42,12 @@ import com.github.jobson.jobinputs.sql.SQLInput; import com.github.jobson.jobinputs.sql.TableSchema; import com.github.jobson.jobs.JobId; +import com.github.jobson.jobs.JobOutput; import com.github.jobson.jobs.JobStatus; import com.github.jobson.jobs.JobTimestamp; import com.github.jobson.jobs.jobstates.ValidJobRequest; import com.github.jobson.specs.*; -import com.github.jobson.websockets.v1.JobEvent; +import com.github.jobson.utils.BinaryData; import io.reactivex.Observable; import org.glassfish.jersey.internal.util.Producer; @@ -55,7 +56,6 @@ import java.nio.file.Path; import java.security.Principal; import java.util.*; -import java.util.function.Supplier; import java.util.stream.Stream; import static io.dropwizard.testing.FixtureHelpers.fixture; diff --git a/src/test/java/com/github/jobson/dao/jobs/FilesystemJobsDAOTest.java b/src/test/java/com/github/jobson/dao/jobs/FilesystemJobsDAOTest.java index a590ace..d8c8c87 100644 --- a/src/test/java/com/github/jobson/dao/jobs/FilesystemJobsDAOTest.java +++ b/src/test/java/com/github/jobson/dao/jobs/FilesystemJobsDAOTest.java @@ -22,15 +22,13 @@ import com.github.jobson.Constants; import com.github.jobson.Helpers; import com.github.jobson.TestHelpers; +import com.github.jobson.dao.IdGenerator; import com.github.jobson.jobs.JobId; import com.github.jobson.jobs.JobOutput; -import com.github.jobson.specs.JobOutputId; -import com.github.jobson.utils.BinaryData; -import com.github.jobson.dao.IdGenerator; import com.github.jobson.jobs.jobstates.PersistedJob; import com.github.jobson.jobs.jobstates.ValidJobRequest; +import com.github.jobson.specs.JobOutputId; import com.github.jobson.specs.JobSpec; -import org.apache.commons.io.IOUtils; import org.junit.Test; import java.io.FileNotFoundException; @@ -40,14 +38,10 @@ import java.nio.file.Paths; import java.util.Optional; -import static com.github.jobson.Constants.FILESYSTEM_JOBS_DAO_DISK_SPACE_HEALTHCHECK; -import static com.github.jobson.Constants.JOB_DIR_JOB_DETAILS_FILENAME; -import static com.github.jobson.Constants.JOB_DIR_OUTPUTS_DIRNAME; +import static com.github.jobson.Constants.*; import static com.github.jobson.Helpers.*; import static com.github.jobson.Helpers.readJSON; import static com.github.jobson.TestHelpers.*; -import static com.github.jobson.utils.BinaryData.wrap; -import static org.apache.commons.io.IOUtils.toByteArray; import static org.assertj.core.api.Assertions.assertThat; public final class FilesystemJobsDAOTest extends JobsDAOTest { diff --git a/src/test/java/com/github/jobson/dao/jobs/JobsDAOTest.java b/src/test/java/com/github/jobson/dao/jobs/JobsDAOTest.java index c65eac6..ddc009d 100644 --- a/src/test/java/com/github/jobson/dao/jobs/JobsDAOTest.java +++ b/src/test/java/com/github/jobson/dao/jobs/JobsDAOTest.java @@ -27,10 +27,9 @@ import com.github.jobson.jobs.JobOutput; import com.github.jobson.jobs.JobStatus; import com.github.jobson.jobs.JobTimestamp; +import com.github.jobson.jobs.jobstates.ValidJobRequest; import com.github.jobson.specs.JobOutputId; import com.github.jobson.utils.BinaryData; -import com.github.jobson.jobs.jobstates.ValidJobRequest; -import com.github.jobson.specs.JobExpectedOutput; import io.reactivex.Observable; import io.reactivex.disposables.Disposable; import io.reactivex.subjects.PublishSubject; @@ -47,13 +46,10 @@ import java.util.stream.Stream; import static com.github.jobson.Constants.JOB_TIMESTAMP_RESOLUTION_IN_MILLISECONDS; -import static com.github.jobson.Helpers.mapValues; -import static com.github.jobson.Helpers.randomKeyIn; -import static com.github.jobson.Helpers.randomSubstring; +import static com.github.jobson.Helpers.*; import static com.github.jobson.TestHelpers.*; import static com.github.jobson.jobs.JobStatus.FINISHED; import static com.github.jobson.jobs.JobStatus.RUNNING; -import static com.github.jobson.utils.BinaryData.wrap; import static com.google.common.collect.Lists.reverse; import static java.lang.Thread.sleep; import static java.util.stream.Collectors.*; diff --git a/src/test/java/com/github/jobson/dao/specs/FilesystemJobSpecDAOTest.java b/src/test/java/com/github/jobson/dao/specs/FilesystemJobSpecDAOTest.java index 5c1b362..c23106b 100644 --- a/src/test/java/com/github/jobson/dao/specs/FilesystemJobSpecDAOTest.java +++ b/src/test/java/com/github/jobson/dao/specs/FilesystemJobSpecDAOTest.java @@ -19,11 +19,10 @@ package com.github.jobson.dao.specs; -import com.github.jobson.Constants; import com.github.jobson.TestHelpers; import com.github.jobson.dao.jobs.FilesystemJobsDAOTest; -import com.github.jobson.specs.JobSpecId; import com.github.jobson.specs.JobSpec; +import com.github.jobson.specs.JobSpecId; import org.junit.Test; import java.io.FileNotFoundException; diff --git a/src/test/java/com/github/jobson/fixtures/PersistedJobRequestFixture.java b/src/test/java/com/github/jobson/fixtures/PersistedJobRequestFixture.java index 71af843..cfa2c00 100644 --- a/src/test/java/com/github/jobson/fixtures/PersistedJobRequestFixture.java +++ b/src/test/java/com/github/jobson/fixtures/PersistedJobRequestFixture.java @@ -22,9 +22,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.JsonNode; import com.github.jobson.api.v1.APIJobRequest; -import com.github.jobson.jobs.JobId; import com.github.jobson.api.v1.UserId; import com.github.jobson.jobinputs.JobExpectedInputId; +import com.github.jobson.jobs.JobId; import com.github.jobson.jobs.jobstates.PersistedJob; import com.github.jobson.jobs.jobstates.ValidJobRequest; import com.github.jobson.specs.JobSpec; diff --git a/src/test/java/com/github/jobson/jobs/execution/JobExecutorTest.java b/src/test/java/com/github/jobson/jobs/execution/JobExecutorTest.java index 06d0bbb..fcea31a 100644 --- a/src/test/java/com/github/jobson/jobs/execution/JobExecutorTest.java +++ b/src/test/java/com/github/jobson/jobs/execution/JobExecutorTest.java @@ -21,8 +21,8 @@ import com.github.jobson.TestConstants; import com.github.jobson.TestHelpers; -import com.github.jobson.jobs.*; import com.github.jobson.fixtures.PersistedJobRequestFixture; +import com.github.jobson.jobs.*; import com.github.jobson.jobs.jobstates.PersistedJob; import com.github.jobson.specs.*; import com.github.jobson.utils.CancelablePromise; diff --git a/src/test/java/com/github/jobson/jobs/management/JobManagerTest.java b/src/test/java/com/github/jobson/jobs/management/JobManagerTest.java index fe8367d..837bb03 100644 --- a/src/test/java/com/github/jobson/jobs/management/JobManagerTest.java +++ b/src/test/java/com/github/jobson/jobs/management/JobManagerTest.java @@ -22,11 +22,11 @@ import com.codahale.metrics.health.HealthCheck; import com.github.jobson.Constants; import com.github.jobson.TestHelpers; -import com.github.jobson.jobs.*; -import com.github.jobson.specs.JobOutputId; import com.github.jobson.dao.jobs.WritingJobDAO; +import com.github.jobson.jobs.*; import com.github.jobson.jobs.jobstates.FinalizedJob; import com.github.jobson.specs.JobExpectedOutput; +import com.github.jobson.specs.JobOutputId; import com.github.jobson.utils.CancelablePromise; import com.github.jobson.utils.SimpleCancelablePromise; import com.github.jobson.websockets.v1.JobEvent; @@ -53,9 +53,9 @@ import static com.github.jobson.TestConstants.DEFAULT_TIMEOUT; import static com.github.jobson.TestHelpers.STANDARD_VALID_REQUEST; import static com.github.jobson.TestHelpers.generateRandomBytes; +import static com.github.jobson.jobs.JobEventListeners.createNullListeners; import static com.github.jobson.jobs.JobStatus.*; import static com.github.jobson.utils.BinaryData.wrap; -import static com.github.jobson.jobs.JobEventListeners.createNullListeners; import static java.util.Arrays.asList; import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.SECONDS; diff --git a/src/test/java/com/github/jobson/jobs/management/MockInMemoryJobWriter.java b/src/test/java/com/github/jobson/jobs/management/MockInMemoryJobWriter.java index 6fda622..e0cadf5 100644 --- a/src/test/java/com/github/jobson/jobs/management/MockInMemoryJobWriter.java +++ b/src/test/java/com/github/jobson/jobs/management/MockInMemoryJobWriter.java @@ -19,11 +19,10 @@ package com.github.jobson.jobs.management; +import com.github.jobson.dao.jobs.WritingJobDAO; import com.github.jobson.jobs.JobId; import com.github.jobson.jobs.JobOutput; import com.github.jobson.jobs.JobStatus; -import com.github.jobson.utils.BinaryData; -import com.github.jobson.dao.jobs.WritingJobDAO; import com.github.jobson.jobs.jobstates.PersistedJob; import com.github.jobson.jobs.jobstates.ValidJobRequest; import io.reactivex.Observable; diff --git a/src/test/java/com/github/jobson/jobs/management/MockJobExecutor.java b/src/test/java/com/github/jobson/jobs/management/MockJobExecutor.java index 2136806..9fd3abe 100644 --- a/src/test/java/com/github/jobson/jobs/management/MockJobExecutor.java +++ b/src/test/java/com/github/jobson/jobs/management/MockJobExecutor.java @@ -20,9 +20,9 @@ package com.github.jobson.jobs.management; import com.github.jobson.jobs.JobEventListeners; -import com.github.jobson.jobs.JobStatus; import com.github.jobson.jobs.JobExecutionResult; import com.github.jobson.jobs.JobExecutor; +import com.github.jobson.jobs.JobStatus; import com.github.jobson.jobs.jobstates.PersistedJob; import com.github.jobson.utils.CancelablePromise; import com.github.jobson.utils.SimpleCancelablePromise; diff --git a/src/test/java/com/github/jobson/resources/v1/JobResourceTest.java b/src/test/java/com/github/jobson/resources/v1/JobResourceTest.java index fb579e4..3643f0c 100644 --- a/src/test/java/com/github/jobson/resources/v1/JobResourceTest.java +++ b/src/test/java/com/github/jobson/resources/v1/JobResourceTest.java @@ -24,25 +24,22 @@ import com.github.jobson.HttpStatusCodes; import com.github.jobson.TestHelpers; import com.github.jobson.api.v1.*; -import com.github.jobson.dao.jobs.JobOutputDetails; -import com.github.jobson.jobs.JobOutput; -import com.github.jobson.specs.JobOutputId; -import com.github.jobson.utils.BinaryData; import com.github.jobson.dao.jobs.JobDAO; import com.github.jobson.dao.jobs.JobDetails; +import com.github.jobson.dao.jobs.JobOutputDetails; import com.github.jobson.dao.jobs.ReadonlyJobDAO; import com.github.jobson.dao.specs.JobSpecConfigurationDAO; import com.github.jobson.jobinputs.JobExpectedInputId; import com.github.jobson.jobinputs.JobInput; import com.github.jobson.jobinputs.select.SelectInput; import com.github.jobson.jobs.JobId; -import com.github.jobson.jobs.JobStatus; import com.github.jobson.jobs.JobManagerActions; +import com.github.jobson.jobs.JobStatus; import com.github.jobson.jobs.jobstates.FinalizedJob; import com.github.jobson.jobs.jobstates.ValidJobRequest; -import com.github.jobson.specs.JobExpectedOutput; import com.github.jobson.specs.JobSpec; import com.github.jobson.specs.JobSpecId; +import com.github.jobson.utils.BinaryData; import com.github.jobson.utils.CancelablePromise; import com.github.jobson.utils.SimpleCancelablePromise; import org.apache.commons.lang3.tuple.Pair; @@ -55,7 +52,10 @@ import javax.ws.rs.core.StreamingOutput; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.util.*; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; import java.util.stream.Collectors; import static com.github.jobson.Constants.HTTP_JOBS_PATH; diff --git a/src/test/java/com/github/jobson/resources/v1/JobSpecResourceTest.java b/src/test/java/com/github/jobson/resources/v1/JobSpecResourceTest.java index 4f5fbf8..2888b08 100644 --- a/src/test/java/com/github/jobson/resources/v1/JobSpecResourceTest.java +++ b/src/test/java/com/github/jobson/resources/v1/JobSpecResourceTest.java @@ -23,10 +23,10 @@ import com.github.jobson.api.v1.APIJobSpec; import com.github.jobson.api.v1.APIJobSpecSummary; import com.github.jobson.api.v1.APIJobSpecSummaryCollection; -import com.github.jobson.specs.JobSpecId; import com.github.jobson.dao.specs.JobSpecDAO; import com.github.jobson.dao.specs.JobSpecSummary; import com.github.jobson.specs.JobSpec; +import com.github.jobson.specs.JobSpecId; import org.junit.Test; import javax.ws.rs.WebApplicationException; diff --git a/src/test/java/com/github/jobson/systemtests/commands/RunCommandTest.java b/src/test/java/com/github/jobson/systemtests/commands/RunCommandTest.java new file mode 100644 index 0000000..42fc8e4 --- /dev/null +++ b/src/test/java/com/github/jobson/systemtests/commands/RunCommandTest.java @@ -0,0 +1,60 @@ +/* + * 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. + */ + + +package com.github.jobson.systemtests.commands; + +import com.github.jobson.Constants; +import com.github.jobson.Helpers; +import com.github.jobson.TestHelpers; +import org.junit.Test; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; + +import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat; + +public final class RunCommandTest { + + @Test + public void testCanRunAProgramInstalledViaATrivialEndToEndWorkflow() throws IOException, InterruptedException { + final Path pwd = Files.createTempDirectory(RunCommandTest.class.getSimpleName()); + + final int newCommandExitCode = CliHelpers.run(pwd.toFile(), "new"); + assertThat(newCommandExitCode).isEqualTo(0); + + final String installedSpecId = TestHelpers.generateRandomString(); + + final int generateExitCode = CliHelpers.run(pwd.toFile(), "generate", "spec", installedSpecId); + assertThat(generateExitCode).isEqualTo(0); + + final String specText = + Helpers.loadResourceFileAsString("fixtures/systemtests/commands/trivial-spec.yml"); + + final Path specFilePath = pwd + .resolve(Constants.WORKSPACE_SPECS_DIRNAME) + .resolve(installedSpecId) + .resolve(Constants.SPEC_DIR_SPEC_FILENAME); + + Files.write(specFilePath, specText.getBytes()); + + // TODO: Intercept output from `generate request ${specId}` + } +} diff --git a/src/test/java/com/github/jobson/systemtests/commands/ValidateCommandTest.java b/src/test/java/com/github/jobson/systemtests/commands/ValidateCommandTest.java index 4f34611..11f9295 100644 --- a/src/test/java/com/github/jobson/systemtests/commands/ValidateCommandTest.java +++ b/src/test/java/com/github/jobson/systemtests/commands/ValidateCommandTest.java @@ -20,6 +20,7 @@ package com.github.jobson.systemtests.commands; +import com.github.jobson.TestHelpers; import org.junit.Test; import java.io.IOException; @@ -34,4 +35,18 @@ public void testCallingValidateCommandHelpReturnsExitCode0() throws IOException, assertThat(exitCode).isEqualTo(0); } + + @Test + public void testCallingValidateSpecHelpCommandHelpReturnsExitCode0() throws IOException, InterruptedException { + final int exitCode = CliHelpers.run("validate", "spec", "--help"); + + assertThat(exitCode).isEqualTo(0); + } + + @Test + public void testCallingInvalidValidateSubcommandWithHelpReturnsNonzeroExitCode() throws IOException, InterruptedException { + final int exitCode = CliHelpers.run("validate", TestHelpers.generateRandomString(), "--help"); + + assertThat(exitCode).isNotEqualTo(0); + } } diff --git a/src/test/java/com/github/jobson/systemtests/httpapi/TestJobsAPI.java b/src/test/java/com/github/jobson/systemtests/httpapi/TestJobsAPI.java index 98e77a6..331ce57 100644 --- a/src/test/java/com/github/jobson/systemtests/httpapi/TestJobsAPI.java +++ b/src/test/java/com/github/jobson/systemtests/httpapi/TestJobsAPI.java @@ -23,7 +23,6 @@ import com.fasterxml.jackson.databind.JsonNode; import com.github.jobson.api.v1.*; import com.github.jobson.config.ApplicationConfig; -import com.github.jobson.dao.jobs.JobOutputDetails; import com.github.jobson.jobinputs.JobExpectedInputId; import com.github.jobson.jobs.JobId; import com.github.jobson.specs.JobOutputId; diff --git a/src/test/java/com/github/jobson/systemtests/httpapi/TestUsersAPI.java b/src/test/java/com/github/jobson/systemtests/httpapi/TestUsersAPI.java index a69bdd6..c1b1811 100644 --- a/src/test/java/com/github/jobson/systemtests/httpapi/TestUsersAPI.java +++ b/src/test/java/com/github/jobson/systemtests/httpapi/TestUsersAPI.java @@ -21,7 +21,6 @@ import com.github.jobson.api.v1.APIUserDetails; import com.github.jobson.config.ApplicationConfig; -import com.github.jobson.resources.v1.UserResource; import io.dropwizard.testing.junit.DropwizardAppRule; import org.junit.ClassRule; import org.junit.Test; diff --git a/src/test/resources/fixtures/systemtests/commands/trivial-spec.yml b/src/test/resources/fixtures/systemtests/commands/trivial-spec.yml new file mode 100644 index 0000000..abb971b --- /dev/null +++ b/src/test/resources/fixtures/systemtests/commands/trivial-spec.yml @@ -0,0 +1,9 @@ +name: A trivial spec +description: This should be easy to run +expectedInputs: +- id: inputA + type: string +execution: + application: echo + arguments: + - ${inputs.inputA} \ No newline at end of file From b448e5835dc5cc10ef80db907e84db1c58950f91 Mon Sep 17 00:00:00 2001 From: Adam Kewley Date: Tue, 5 Dec 2017 22:01:24 +0000 Subject: [PATCH 04/11] Minor refactoring --- src/main/java/com/github/jobson/Helpers.java | 5 ++-- .../github/jobson/commands/RunCommand.java | 12 +------- .../generators/GenerateRequestCommand.java | 19 +++++++----- .../jobson/commands/users/UseraddCommand.java | 30 +++++++++++-------- .../validators/ValidateSpecCommand.java | 4 +-- .../dao/specs/FilesystemJobSpecDAO.java | 4 +-- .../com/github/jobson/jobs/JobStatus.java | 13 ++++++++ 7 files changed, 48 insertions(+), 39 deletions(-) diff --git a/src/main/java/com/github/jobson/Helpers.java b/src/main/java/com/github/jobson/Helpers.java index 96868da..d2fca0f 100644 --- a/src/main/java/com/github/jobson/Helpers.java +++ b/src/main/java/com/github/jobson/Helpers.java @@ -33,6 +33,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.io.BufferedInputStream; import java.io.File; import java.io.IOException; import java.io.InputStream; @@ -40,8 +41,8 @@ import java.nio.file.Path; import java.util.*; import java.util.concurrent.atomic.AtomicBoolean; -import java.util.function.Consumer; -import java.util.function.Function; +import java.util.function.*; +import java.util.stream.Collector; import java.util.stream.Collectors; import java.util.stream.Stream; import java.util.stream.StreamSupport; diff --git a/src/main/java/com/github/jobson/commands/RunCommand.java b/src/main/java/com/github/jobson/commands/RunCommand.java index 345273b..c0fec73 100644 --- a/src/main/java/com/github/jobson/commands/RunCommand.java +++ b/src/main/java/com/github/jobson/commands/RunCommand.java @@ -197,17 +197,7 @@ private EitherVisitor> createResultVisito public void whenLeft(ValidJobRequest left) { try { final FinalizedJob f = jobManager.submit(left, listeners).getRight().get(); - - switch (f.getFinalStatus()) { - case ABORTED: - System.exit(112); - case FATAL_ERROR: - System.exit(1); - case FINISHED: - System.exit(0); - default: - System.exit(1); - } + System.exit(f.getFinalStatus().toExitCode()); } catch (Exception ex) { System.err.println("Error encountered: " + ex.toString()); System.exit(1); diff --git a/src/main/java/com/github/jobson/commands/generators/GenerateRequestCommand.java b/src/main/java/com/github/jobson/commands/generators/GenerateRequestCommand.java index d30db11..e83556e 100644 --- a/src/main/java/com/github/jobson/commands/generators/GenerateRequestCommand.java +++ b/src/main/java/com/github/jobson/commands/generators/GenerateRequestCommand.java @@ -24,6 +24,7 @@ import com.github.jobson.api.v1.APIJobRequest; import com.github.jobson.commands.DefaultedConfiguredCommand; import com.github.jobson.config.ApplicationConfig; +import com.github.jobson.jobinputs.JobExpectedInput; import com.github.jobson.jobinputs.JobExpectedInputId; import com.github.jobson.jobinputs.JobInput; import com.github.jobson.specs.JobSpec; @@ -34,7 +35,6 @@ import java.nio.file.Path; import java.nio.file.Paths; -import java.util.AbstractMap; import java.util.Map; import static com.github.jobson.Constants.SPEC_DIR_SPEC_FILENAME; @@ -82,12 +82,15 @@ protected void run(Bootstrap bootstrap, Namespace namespace, } private Map generateInputs(JobSpec jobSpec) { - return jobSpec.getExpectedInputs().stream().map(expectedInput -> { - final JobExpectedInputId id = expectedInput.getId(); - final JobInput generatedInput = expectedInput.getDefault().isPresent() ? - expectedInput.getDefault().get() : expectedInput.generateExampleInput(); - final JsonNode inputAsNode = toJSONNode(generatedInput); - return new AbstractMap.SimpleEntry<>(id, inputAsNode); - }).collect(toMap(e -> e.getKey(), e -> e.getValue())); + return jobSpec + .getExpectedInputs() + .stream() + .collect(toMap(JobExpectedInput::getId, this::generateInput)); + } + + private JsonNode generateInput(JobExpectedInput expectedInput) { + final JobInput generatedInput = expectedInput.getDefault().isPresent() ? + expectedInput.getDefault().get() : expectedInput.generateExampleInput(); + return toJSONNode(generatedInput); } } diff --git a/src/main/java/com/github/jobson/commands/users/UseraddCommand.java b/src/main/java/com/github/jobson/commands/users/UseraddCommand.java index 3eeb9be..681226e 100644 --- a/src/main/java/com/github/jobson/commands/users/UseraddCommand.java +++ b/src/main/java/com/github/jobson/commands/users/UseraddCommand.java @@ -67,22 +67,26 @@ protected void run(Bootstrap bootstrap, Namespace namespace, final boolean userExists = dao.getUserCredentialsById(login).isPresent(); if (!userExists) { - final String password = namespace.getString(PASSWORD_ARG) == null ? - generateRandomBase36String(30) : - namespace.getString(PASSWORD_ARG); - - final boolean userAdded = - dao.addNewUser(login, BASIC_AUTH_NAME, BasicAuthenticator.createAuthField(password)); - - if (userAdded) { - System.exit(0); - } else { - System.err.println("encountered an error adding a new user (this shouldn't happen)"); - System.exit(1); - } + addNewUser(namespace, dao, login); } else { System.err.println(format("user '%s' already exists, you can set this user's password with `passwd`.", login)); System.exit(1); } } + + private void addNewUser(Namespace namespace, FilesystemUserDAO dao, UserId login) { + final String password = namespace.getString(PASSWORD_ARG) == null ? + generateRandomBase36String(30) : + namespace.getString(PASSWORD_ARG); + + final boolean userAdded = + dao.addNewUser(login, BASIC_AUTH_NAME, BasicAuthenticator.createAuthField(password)); + + if (userAdded) { + System.exit(0); + } else { + System.err.println("encountered an error adding a new user (this shouldn't happen)"); + System.exit(1); + } + } } diff --git a/src/main/java/com/github/jobson/commands/validators/ValidateSpecCommand.java b/src/main/java/com/github/jobson/commands/validators/ValidateSpecCommand.java index 3baf2f0..8348c0b 100644 --- a/src/main/java/com/github/jobson/commands/validators/ValidateSpecCommand.java +++ b/src/main/java/com/github/jobson/commands/validators/ValidateSpecCommand.java @@ -38,13 +38,13 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; -import java.util.stream.Collectors; import java.util.stream.Stream; import static com.github.jobson.Constants.SPEC_DIR_SPEC_FILENAME; import static com.github.jobson.Helpers.readYAML; import static java.util.Collections.singletonList; import static java.util.stream.Collectors.toList; +import static java.util.stream.Collectors.toMap; public final class ValidateSpecCommand extends DefaultedConfiguredCommand { @@ -77,7 +77,7 @@ protected void run(Bootstrap bootstrap, Namespace namespace, specIds.stream() .map(specId -> getSpecErrors(jobSpecsDir, specId)) .filter(entry -> entry.getValue().size() > 0) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); + .collect(toMap(e -> e.getKey(), e -> e.getValue())); if (allErrors.size() > 0) { allErrors.forEach(this::printErrors); diff --git a/src/main/java/com/github/jobson/dao/specs/FilesystemJobSpecDAO.java b/src/main/java/com/github/jobson/dao/specs/FilesystemJobSpecDAO.java index 9cfeaa7..dad2644 100644 --- a/src/main/java/com/github/jobson/dao/specs/FilesystemJobSpecDAO.java +++ b/src/main/java/com/github/jobson/dao/specs/FilesystemJobSpecDAO.java @@ -30,7 +30,6 @@ import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; -import java.nio.file.Files; import java.nio.file.NotDirectoryException; import java.nio.file.Path; import java.util.List; @@ -55,8 +54,7 @@ private static Optional loadJobSpec(Path jobSpecDir) { try { if (jobSpecPath.toFile().exists()) { - final String jobSpecYAML = new String(Files.readAllBytes(jobSpecPath)); - final JobSpec jobSpec = readYAML(jobSpecYAML, JobSpec.class); + final JobSpec jobSpec = readYAML(jobSpecPath.toFile(), JobSpec.class); jobSpec.setId(new JobSpecId(jobSpecDir.toFile().getName())); final JobSpec resolvedJobSpec = jobSpec.withDependenciesResolvedRelativeTo(jobSpecDir); diff --git a/src/main/java/com/github/jobson/jobs/JobStatus.java b/src/main/java/com/github/jobson/jobs/JobStatus.java index 1b5e074..10dc85e 100644 --- a/src/main/java/com/github/jobson/jobs/JobStatus.java +++ b/src/main/java/com/github/jobson/jobs/JobStatus.java @@ -62,4 +62,17 @@ public static Set getAbortableStatuses() { public boolean isAbortable() { return getAbortableStatuses().contains(this); } + + public int toExitCode() { + switch (this) { + case ABORTED: + return 112; + case FATAL_ERROR: + return 1; + case FINISHED: + return 0; + default: + return 1; + } + } } From d3a5a8191c34edd1808886451458d445cd7635b8 Mon Sep 17 00:00:00 2001 From: Adam Kewley Date: Sat, 16 Dec 2017 12:01:05 +0000 Subject: [PATCH 05/11] Added more tests to the new command (it's used a lot by external devs) --- .../jobson/commands/users/UseraddCommand.java | 2 +- .../systemtests/commands/CliHelpers.java | 18 +++++++- .../systemtests/commands/CliOutputs.java | 45 +++++++++++++++++++ .../systemtests/commands/NewCommandTest.java | 26 +++++++++++ 4 files changed, 88 insertions(+), 3 deletions(-) create mode 100644 src/test/java/com/github/jobson/systemtests/commands/CliOutputs.java diff --git a/src/main/java/com/github/jobson/commands/users/UseraddCommand.java b/src/main/java/com/github/jobson/commands/users/UseraddCommand.java index 681226e..226b963 100644 --- a/src/main/java/com/github/jobson/commands/users/UseraddCommand.java +++ b/src/main/java/com/github/jobson/commands/users/UseraddCommand.java @@ -40,7 +40,7 @@ public final class UseraddCommand extends DefaultedConfiguredCommand getAllArgs(List extraArgs) { diff --git a/src/test/java/com/github/jobson/systemtests/commands/CliOutputs.java b/src/test/java/com/github/jobson/systemtests/commands/CliOutputs.java new file mode 100644 index 0000000..55bd858 --- /dev/null +++ b/src/test/java/com/github/jobson/systemtests/commands/CliOutputs.java @@ -0,0 +1,45 @@ +/* + * 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. + */ + + +package com.github.jobson.systemtests.commands; + +public final class CliOutputs { + private final byte stdout[]; + private final byte stderr[]; + private final int exitCode; + + public CliOutputs(byte[] stdout, byte[] stderr, int exitCode) { + this.stdout = stdout; + this.stderr = stderr; + this.exitCode = exitCode; + } + + public byte[] getStdout() { + return stdout; + } + + public byte[] getStderr() { + return stderr; + } + + public int getExitCode() { + return exitCode; + } +} diff --git a/src/test/java/com/github/jobson/systemtests/commands/NewCommandTest.java b/src/test/java/com/github/jobson/systemtests/commands/NewCommandTest.java index c71e444..fc3980d 100644 --- a/src/test/java/com/github/jobson/systemtests/commands/NewCommandTest.java +++ b/src/test/java/com/github/jobson/systemtests/commands/NewCommandTest.java @@ -21,6 +21,7 @@ package com.github.jobson.systemtests.commands; import com.github.jobson.Constants; +import com.github.jobson.commands.NewCommand; import org.junit.Test; import java.io.IOException; @@ -64,4 +65,29 @@ public void testRunningNewCommandWithDemoProducesASpecThatIsValid() throws IOExc assertThat(validationExitCode).isEqualTo(0); } + + @Test + public void testGeneratingARequestForTheDemoSpecWorks() throws IOException, InterruptedException { + final Path pwd = Files.createTempDirectory(NewCommandTest.class.getSimpleName()); + CliHelpers.run(pwd.toFile(), "new", "--demo"); + final int requestGenerationWorks = CliHelpers.run(pwd.toFile(), "generate", "request", Constants.DEMO_SPEC_DIRNAME); + + assertThat(requestGenerationWorks).isEqualTo(0); + } + + @Test + public void testRunningTheGeneratedRequestLocallyForTheDemoSpecWorks() throws IOException, InterruptedException { + final Path pwd = Files.createTempDirectory(NewCommandTest.class.getSimpleName()); + CliHelpers.run(pwd.toFile(), "new", "--demo"); + final CliOutputs outputs = + CliHelpers.runAndGetOutputs(pwd.toFile(), "generate", "request", Constants.DEMO_SPEC_DIRNAME); + + final byte generatedRequestJson[] = outputs.getStdout(); + final Path generatedRequestPath = Files.createTempFile(NewCommand.class.getSimpleName(), "generatedReq"); + Files.write(generatedRequestPath, generatedRequestJson); + + final int localRunExitCode = CliHelpers.run(pwd.toFile(), "run", generatedRequestPath.toString()); + + assertThat(localRunExitCode).isEqualTo(0); + } } From ea5df70a99844b0b9e6155d49a4a6542f759f608 Mon Sep 17 00:00:00 2001 From: Adam Kewley Date: Sat, 16 Dec 2017 12:07:56 +0000 Subject: [PATCH 06/11] Updated dropwizard to 1.2.2 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index de56a9d..a9e1e7a 100644 --- a/pom.xml +++ b/pom.xml @@ -48,7 +48,7 @@ UTF-8 UTF-8 - 1.1.1 + 1.2.2 com.github.jobson.App From 507ebf1b9651bd36c2041b10e82e135c03b7329f Mon Sep 17 00:00:00 2001 From: Adam Kewley Date: Sat, 16 Dec 2017 12:09:09 +0000 Subject: [PATCH 07/11] Updated maven-shade-plugin to 3.1.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a9e1e7a..261f7d8 100644 --- a/pom.xml +++ b/pom.xml @@ -211,7 +211,7 @@ maven-shade-plugin - 2.4.1 + 3.1.0 package From f99974b9e4f6c7a155f02d1b7a85c4d9f2903486 Mon Sep 17 00:00:00 2001 From: Adam Kewley Date: Sat, 16 Dec 2017 12:10:31 +0000 Subject: [PATCH 08/11] Updated antlr4-maven-plugin --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 261f7d8..6286814 100644 --- a/pom.xml +++ b/pom.xml @@ -192,7 +192,7 @@ org.antlr antlr4-maven-plugin - 4.7 + 4.7.1 From 4610c17d690545bee71c4e962b7eadf14770e6c4 Mon Sep 17 00:00:00 2001 From: Adam Kewley Date: Sat, 16 Dec 2017 12:11:47 +0000 Subject: [PATCH 09/11] Updated maven-compiler plugin to 3.7.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 6286814..c46378d 100644 --- a/pom.xml +++ b/pom.xml @@ -181,7 +181,7 @@ maven-compiler-plugin - 3.3 + 3.7.0 1.8 1.8 From 6bfb7840e2657b6936917859d827747bb6e6e5d9 Mon Sep 17 00:00:00 2001 From: Adam Kewley Date: Sat, 16 Dec 2017 12:26:58 +0000 Subject: [PATCH 10/11] Updated all dependencies --- pom.xml | 32 ++++++------------- .../jobson/utils/AllColumnRefsFinder.java | 16 +++++++--- 2 files changed, 21 insertions(+), 27 deletions(-) diff --git a/pom.xml b/pom.xml index c46378d..7181023 100644 --- a/pom.xml +++ b/pom.xml @@ -78,33 +78,33 @@ commons-io commons-io - 1.3.2 + 2.5 commons-codec commons-codec - 1.9 + 1.11 io.reactivex.rxjava2 rxjava - 2.1.0 + 2.1.7 org.eclipse.jetty.websocket javax-websocket-server-impl - 9.4.2.v20170220 + 9.4.8.v20171121 com.github.javafaker javafaker - 0.13 + 0.14 @@ -118,14 +118,14 @@ com.github.jsqlparser jsqlparser - 1.0 + 1.1 io.swagger swagger-annotations - 1.5.12 + 1.5.17 compile @@ -133,18 +133,11 @@ org.antlr antlr4-runtime - 4.7 + 4.7.1 compile - - - org.glassfish.jersey.test-framework - jersey-test-framework-util - test - 2.24 - junit @@ -156,7 +149,7 @@ org.mockito mockito-all - 1.9.5 + 1.10.19 test @@ -166,13 +159,6 @@ test - - org.java-websocket - Java-WebSocket - 1.3.4 - test - - diff --git a/src/main/java/com/github/jobson/utils/AllColumnRefsFinder.java b/src/main/java/com/github/jobson/utils/AllColumnRefsFinder.java index bcaf568..53d7223 100644 --- a/src/main/java/com/github/jobson/utils/AllColumnRefsFinder.java +++ b/src/main/java/com/github/jobson/utils/AllColumnRefsFinder.java @@ -25,10 +25,7 @@ import net.sf.jsqlparser.expression.operators.conditional.OrExpression; import net.sf.jsqlparser.expression.operators.relational.*; import net.sf.jsqlparser.schema.Column; -import net.sf.jsqlparser.statement.SetStatement; -import net.sf.jsqlparser.statement.Statement; -import net.sf.jsqlparser.statement.StatementVisitor; -import net.sf.jsqlparser.statement.Statements; +import net.sf.jsqlparser.statement.*; import net.sf.jsqlparser.statement.alter.Alter; import net.sf.jsqlparser.statement.create.index.CreateIndex; import net.sf.jsqlparser.statement.create.table.CreateTable; @@ -43,6 +40,7 @@ import net.sf.jsqlparser.statement.select.*; import net.sf.jsqlparser.statement.truncate.Truncate; import net.sf.jsqlparser.statement.update.Update; +import net.sf.jsqlparser.statement.upsert.Upsert; import java.util.HashSet; import java.util.Set; @@ -223,6 +221,11 @@ public void visit(WithItem withItem) { throw new UnsupportedSQLFeatureException("Feature WithItem not supported"); } + @Override + public void visit(Commit commit) { + throw new UnsupportedSQLFeatureException("Feature Commit not supported"); + } + public void visit(Delete delete) { throw new UnsupportedSQLFeatureException("Feature Delete not supported"); } @@ -408,4 +411,9 @@ public void visit(DateTimeLiteralExpression dateTimeLiteralExpression) { public void visit(NotExpression notExpression) { throw new UnsupportedSQLFeatureException("Feature NotExpression not supported"); } + + @Override + public void visit(Upsert upsert) { + throw new UnsupportedSQLFeatureException("Feature Upsert not supported"); + } } From a1b2f587276e3ddb60e3353330704a0d0c3e5677 Mon Sep 17 00:00:00 2001 From: Adam Kewley Date: Sat, 16 Dec 2017 12:29:39 +0000 Subject: [PATCH 11/11] Updated pom.xml to match 0.0.4 and latest description on github --- pom.xml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 7181023..4b938a9 100644 --- a/pom.xml +++ b/pom.xml @@ -6,9 +6,11 @@ com.github.jobson jobson - 0.0.3 + 0.0.4 jobson - Webify command-line applications + + A web server that can turn command-line applications into a job system. + https://github.com/adamkewley/jobson 2017