You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by pu...@apache.org on 2015/04/07 20:52:42 UTC

oozie git commit: OOZIE-2182 SLA alert commands are not in sync with doc

Repository: oozie
Updated Branches:
  refs/heads/master 4ef1fa443 -> e1bf5e256


OOZIE-2182 SLA alert commands are not in sync with doc


Project: http://git-wip-us.apache.org/repos/asf/oozie/repo
Commit: http://git-wip-us.apache.org/repos/asf/oozie/commit/e1bf5e25
Tree: http://git-wip-us.apache.org/repos/asf/oozie/tree/e1bf5e25
Diff: http://git-wip-us.apache.org/repos/asf/oozie/diff/e1bf5e25

Branch: refs/heads/master
Commit: e1bf5e2566cd2f2707d2df585b7baa560a4941ce
Parents: 4ef1fa4
Author: Purshotam Shah <pu...@yahoo-inc.com>
Authored: Tue Apr 7 11:52:11 2015 -0700
Committer: Purshotam Shah <pu...@yahoo-inc.com>
Committed: Tue Apr 7 11:52:11 2015 -0700

----------------------------------------------------------------------
 .../java/org/apache/oozie/cli/OozieCLI.java     |  6 +--
 .../org/apache/oozie/client/TestOozieCLI.java   | 45 ++++++++++++++++++++
 .../servlet/MockCoordinatorEngineService.java   | 18 +++++++-
 release-log.txt                                 |  1 +
 4 files changed, 65 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/oozie/blob/e1bf5e25/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 5393f68..22e1021 100644
--- a/client/src/main/java/org/apache/oozie/cli/OozieCLI.java
+++ b/client/src/main/java/org/apache/oozie/cli/OozieCLI.java
@@ -151,9 +151,9 @@ public class OozieCLI {
 
     public static final String LIST_SHARELIB_LIB_OPTION = "shareliblist";
 
-    public static final String SLA_DISABLE_ALERT = "sla_disable";
-    public static final String SLA_ENABLE_ALERT = "sla_enable";
-    public static final String SLA_CHANGE = "sla_change";
+    public static final String SLA_DISABLE_ALERT = "sladisable";
+    public static final String SLA_ENABLE_ALERT = "slaenable";
+    public static final String SLA_CHANGE = "slachange";
 
     public static final String SERVER_CONFIGURATION_OPTION = "configuration";
     public static final String SERVER_OS_ENV_OPTION = "osenv";

http://git-wip-us.apache.org/repos/asf/oozie/blob/e1bf5e25/core/src/test/java/org/apache/oozie/client/TestOozieCLI.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/oozie/client/TestOozieCLI.java b/core/src/test/java/org/apache/oozie/client/TestOozieCLI.java
index 83929f5..e56b679 100644
--- a/core/src/test/java/org/apache/oozie/client/TestOozieCLI.java
+++ b/core/src/test/java/org/apache/oozie/client/TestOozieCLI.java
@@ -1507,6 +1507,51 @@ public class TestOozieCLI extends DagServletTestCase {
         });
     }
 
+    public void testSlaEnable() throws Exception {
+        runTest(END_POINTS, SERVLET_CLASSES, false, new Callable<Void>() {
+            @Override
+            public Void call() throws Exception {
+                HeaderTestingVersionServlet.OOZIE_HEADERS.clear();
+                String oozieUrl = getContextURL();
+                String[] args = new String[] { "job", "-slaenable", "aaa-C", "-oozie", oozieUrl };
+                assertEquals(0, new OozieCLI().run(args));
+                assertEquals(MockCoordinatorEngineService.did, RestConstants.SLA_ENABLE_ALERT);
+                return null;
+            }
+        });
+
+    }
+
+    public void testSlaDisable() throws Exception {
+        runTest(END_POINTS, SERVLET_CLASSES, false, new Callable<Void>() {
+            @Override
+            public Void call() throws Exception {
+                HeaderTestingVersionServlet.OOZIE_HEADERS.clear();
+                String oozieUrl = getContextURL();
+                String[] args = new String[] { "job", "-sladisable", "aaa-C", "-oozie", oozieUrl };
+                assertEquals(0, new OozieCLI().run(args));
+                assertEquals(MockCoordinatorEngineService.did, RestConstants.SLA_DISABLE_ALERT);
+                return null;
+            }
+        });
+
+    }
+
+    public void testSlaChange() throws Exception {
+        runTest(END_POINTS, SERVLET_CLASSES, false, new Callable<Void>() {
+            @Override
+            public Void call() throws Exception {
+                HeaderTestingVersionServlet.OOZIE_HEADERS.clear();
+                String oozieUrl = getContextURL();
+                String[] args = new String[] { "job", "-slachange", "aaa-C", "-oozie", oozieUrl };
+                assertEquals(0, new OozieCLI().run(args));
+                assertEquals(MockCoordinatorEngineService.did, RestConstants.SLA_CHANGE);
+                return null;
+            }
+        });
+
+    }
+
     private String runOozieCLIAndGetStdout(String[] args) {
         PrintStream original = System.out;
         ByteArrayOutputStream baos = new ByteArrayOutputStream();

http://git-wip-us.apache.org/repos/asf/oozie/blob/e1bf5e25/core/src/test/java/org/apache/oozie/servlet/MockCoordinatorEngineService.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/oozie/servlet/MockCoordinatorEngineService.java b/core/src/test/java/org/apache/oozie/servlet/MockCoordinatorEngineService.java
index 035a8d4..0e74f2d 100644
--- a/core/src/test/java/org/apache/oozie/servlet/MockCoordinatorEngineService.java
+++ b/core/src/test/java/org/apache/oozie/servlet/MockCoordinatorEngineService.java
@@ -39,8 +39,6 @@ import org.apache.oozie.client.CoordinatorAction;
 import org.apache.oozie.client.CoordinatorJob;
 import org.apache.oozie.client.CoordinatorJob.Execution;
 import org.apache.oozie.client.rest.RestConstants;
-import org.apache.oozie.command.CommandException;
-import org.apache.oozie.command.coord.CoordUpdateXCommand;
 import org.apache.oozie.service.CoordinatorEngineService;
 import org.apache.oozie.util.DateUtils;
 
@@ -272,6 +270,22 @@ public class MockCoordinatorEngineService extends CoordinatorEngineService {
             return new CoordinatorJobInfo(new ArrayList<CoordinatorJobBean>(), 0, 0, 0);
         }
 
+        public void disableSLAAlert(String id, String actions, String dates, String childIds)
+                throws BaseEngineException {
+            did = RestConstants.SLA_DISABLE_ALERT;
+        }
+
+        @Override
+        public void changeSLA(String id, String actions, String dates, String childIds, String newParams)
+                throws BaseEngineException {
+            did = RestConstants.SLA_CHANGE;
+        }
+
+        @Override
+        public void enableSLAAlert(String id, String actions, String dates, String childIds) throws BaseEngineException {
+            did = RestConstants.SLA_ENABLE_ALERT;
+        }
+
         private int validateCoordinatorIdx(String jobId) throws CoordinatorEngineException {
             int idx = -1;
             try {

http://git-wip-us.apache.org/repos/asf/oozie/blob/e1bf5e25/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index 3c1eca5..8fa51b1 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -1,5 +1,6 @@
 -- Oozie 4.2.0 release (trunk - unreleased)
 
+OOZIE-2182 SLA alert commands are not in sync with doc (puru)
 OOZIE-2191 Upgrade jackson version for hadoop-2 profile (ryota)
 OOZIE-2183 provide an option to disable cleanup for output dataset in rerun (ryota)
 OOZIE-2146 Add option to filter sla information by bundle id or name (ryota)