Repository: oozie Updated Branches: refs/heads/master 2805ab66f -> 12c863e5b
OOZIE-2211 Remove OozieCLI#validateCommandV41 (dbist13 via andras.piros) Project: http://git-wip-us.apache.org/repos/asf/oozie/repo Commit: http://git-wip-us.apache.org/repos/asf/oozie/commit/12c863e5 Tree: http://git-wip-us.apache.org/repos/asf/oozie/tree/12c863e5 Diff: http://git-wip-us.apache.org/repos/asf/oozie/diff/12c863e5 Branch: refs/heads/master Commit: 12c863e5bff6963509e0bc6615acc8184761bdcf Parents: 2805ab6 Author: Andras Piros <andras.pi...@cloudera.com> Authored: Fri May 25 13:44:00 2018 +0200 Committer: Andras Piros <andras.pi...@cloudera.com> Committed: Fri May 25 13:44:00 2018 +0200 ---------------------------------------------------------------------- .../java/org/apache/oozie/cli/OozieCLI.java | 111 ------------------- .../org/apache/oozie/cli/TestValidation.java | 75 ------------- release-log.txt | 1 + 3 files changed, 1 insertion(+), 186 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/oozie/blob/12c863e5/client/src/main/java/org/apache/oozie/cli/OozieCLI.java ---------------------------------------------------------------------- diff --git a/client/src/main/java/org/apache/oozie/cli/OozieCLI.java b/client/src/main/java/org/apache/oozie/cli/OozieCLI.java index 2828633..08e2b91 100644 --- a/client/src/main/java/org/apache/oozie/cli/OozieCLI.java +++ b/client/src/main/java/org/apache/oozie/cli/OozieCLI.java @@ -50,14 +50,9 @@ import org.w3c.dom.NodeList; import org.w3c.dom.Text; import org.xml.sax.SAXException; -import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.stream.StreamSource; -import javax.xml.validation.Schema; -import javax.xml.validation.SchemaFactory; -import javax.xml.validation.Validator; import java.io.File; import java.io.FileInputStream; import java.io.FileReader; @@ -2077,9 +2072,6 @@ public class OozieCLI { XOozieClient wc = createXOozieClient(commandLine); String result = wc.validateXML(args[0].toString()); if (result == null) { - // TODO This is only for backward compatibility. Need to remove after 4.2.0 higher version. - System.out.println("Using client-side validation. Check out Oozie server version."); - validateCommandV41(commandLine); return; } System.out.println(result); @@ -2088,109 +2080,6 @@ public class OozieCLI { } } - /** - * Validate on client-side. This is only for backward compatibility. Need to removed after <tt>4.2.0</tt> higher version. - * @param commandLine - * @throws OozieCLIException - */ - @Deprecated - @VisibleForTesting - void validateCommandV41(CommandLine commandLine) throws OozieCLIException { - String[] args = commandLine.getArgs(); - if (args.length != 1) { - throw new OozieCLIException("One file must be specified"); - } - File file = new File(args[0]); - if (file.exists()) { - try { - List<StreamSource> sources = new ArrayList<StreamSource>(); - sources.add(new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream( - "oozie-workflow-0.1.xsd"))); - sources.add(new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream( - "shell-action-0.1.xsd"))); - sources.add(new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream( - "shell-action-0.2.xsd"))); - sources.add(new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream( - "shell-action-0.3.xsd"))); - sources.add(new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream( - "email-action-0.1.xsd"))); - sources.add(new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream( - "email-action-0.2.xsd"))); - sources.add(new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream( - "distcp-action-0.1.xsd"))); - sources.add(new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream( - "distcp-action-0.2.xsd"))); - sources.add(new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream( - "oozie-workflow-0.2.xsd"))); - sources.add(new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream( - "oozie-workflow-0.2.5.xsd"))); - sources.add(new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream( - "oozie-workflow-0.3.xsd"))); - sources.add(new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream( - "oozie-workflow-0.4.xsd"))); - sources.add(new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream( - "oozie-workflow-0.4.5.xsd"))); - sources.add(new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream( - "oozie-workflow-0.5.xsd"))); - sources.add(new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream( - "oozie-coordinator-0.1.xsd"))); - sources.add(new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream( - "oozie-coordinator-0.2.xsd"))); - sources.add(new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream( - "oozie-coordinator-0.3.xsd"))); - sources.add(new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream( - "oozie-coordinator-0.4.xsd"))); - sources.add(new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream( - "oozie-bundle-0.1.xsd"))); - sources.add(new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream( - "oozie-bundle-0.2.xsd"))); - sources.add(new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream( - "oozie-sla-0.1.xsd"))); - sources.add(new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream( - "oozie-sla-0.2.xsd"))); - sources.add(new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream( - "hive-action-0.2.xsd"))); - sources.add(new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream( - "hive-action-0.3.xsd"))); - sources.add(new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream( - "hive-action-0.4.xsd"))); - sources.add(new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream( - "hive-action-0.5.xsd"))); - sources.add(new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream( - "hive-action-0.6.xsd"))); - sources.add(new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream( - "sqoop-action-0.2.xsd"))); - sources.add(new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream( - "sqoop-action-0.3.xsd"))); - sources.add(new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream( - "sqoop-action-0.4.xsd"))); - sources.add(new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream( - "ssh-action-0.1.xsd"))); - sources.add(new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream( - "ssh-action-0.2.xsd"))); - sources.add(new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream( - "hive2-action-0.1.xsd"))); - sources.add(new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream( - "hive2-action-0.2.xsd"))); - sources.add(new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream( - "spark-action-0.1.xsd"))); - sources.add(new StreamSource(Thread.currentThread().getContextClassLoader().getResourceAsStream( - "spark-action-0.2.xsd"))); - SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); - Schema schema = factory.newSchema(sources.toArray(new StreamSource[sources.size()])); - Validator validator = schema.newValidator(); - validator.validate(new StreamSource(new FileReader(file))); - System.out.println("Valid workflow-app"); - } - catch (Exception ex) { - throw new OozieCLIException("Invalid app definition, " + ex.toString(), ex); - } - } - else { - throw new OozieCLIException("File does not exists"); - } - } - private void scriptLanguageCommand(CommandLine commandLine, String jobType) throws IOException, OozieCLIException { List<String> args = commandLine.getArgList(); if (args.size() > 0) { http://git-wip-us.apache.org/repos/asf/oozie/blob/12c863e5/client/src/test/java/org/apache/oozie/cli/TestValidation.java ---------------------------------------------------------------------- diff --git a/client/src/test/java/org/apache/oozie/cli/TestValidation.java b/client/src/test/java/org/apache/oozie/cli/TestValidation.java deleted file mode 100644 index 82d4430..0000000 --- a/client/src/test/java/org/apache/oozie/cli/TestValidation.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * 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 org.apache.oozie.cli; - -import junit.framework.TestCase; -import org.apache.commons.cli.CommandLine; -import org.apache.commons.cli.ParseException; - -import java.io.ByteArrayOutputStream; -import java.io.PrintStream; -import java.net.URL; -import java.net.URI; -import java.io.File; - -public class TestValidation extends TestCase { - - private String getPath(String resource) throws Exception { - URL url = Thread.currentThread().getContextClassLoader().getResource(resource); - URI uri = url.toURI(); - File file = new File(uri.getPath()); - return file.getAbsolutePath(); - } - - public void testValid() throws Exception { - String[] args = new String[]{"validate", getPath("valid.xml")}; - assertTrue(captureOutput(args).contains("Valid workflow-app")); - } - - public void testInvalid() throws Exception { - String[] args = new String[]{"validate", getPath("invalid.xml")}; - assertTrue(captureOutput(args).contains("Invalid app definition")); - } - - private String captureOutput(String[] args) throws ParseException { - OozieCLI cli = new OozieCLI(); - CLIParser parser = cli.getCLIParser(); - CLIParser.Command command = parser.parse(args); - PrintStream original = System.out; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - PrintStream ps = new PrintStream(baos); - String outStr = null; - System.out.flush(); - try { - System.setOut(ps); - cli.validateCommandV41(command.getCommandLine()); - System.out.flush(); - outStr = baos.toString(); - } catch (OozieCLIException e) { - outStr = e.getMessage(); - } finally { - System.setOut(original); - if (outStr != null) { - System.out.print(outStr); - } - System.out.flush(); - } - return outStr; - } -} http://git-wip-us.apache.org/repos/asf/oozie/blob/12c863e5/release-log.txt ---------------------------------------------------------------------- diff --git a/release-log.txt b/release-log.txt index e142560..cbe849a 100644 --- a/release-log.txt +++ b/release-log.txt @@ -1,5 +1,6 @@ -- Oozie 5.1.0 release (trunk - unreleased) +OOZIE-2211 Remove OozieCLI#validateCommandV41 (dbist13 via andras.piros) OOZIE-3178 ./bin/mkdistro.sh -Papache-release fails due to javadoc errors (dbist13 via gezapeti) OOZIE-2967 TestStatusTransitService.testBundleStatusCoordSubmitFails fails intermittently in Apache Oozie Core 5.0.0-SNAPSHOT (pbacsko) OOZIE-3238 Flaky test TestStatusTransitService#testBundleStatusTransitWithLock (pbacsko via gezapeti, andras.piros)