falcon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From srik...@apache.org
Subject [42/47] git commit: checkstyle related fixes for process module.
Date Fri, 26 Apr 2013 15:50:58 GMT
checkstyle related fixes for process module.


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

Branch: refs/heads/master
Commit: fcfd9b36c88bf375ba8c9d25fa85ea686be8839b
Parents: f8b9122
Author: venkatesh <venkatesh@hortonworks.com>
Authored: Tue Apr 23 13:26:33 2013 -0700
Committer: venkatesh <venkatesh@hortonworks.com>
Committed: Tue Apr 23 13:26:33 2013 -0700

----------------------------------------------------------------------
 .../falcon/converter/OozieProcessMapper.java       |   35 +++++++------
 .../workflow/OozieProcessWorkflowBuilder.java      |   33 ++++++-----
 .../apache/falcon/converter/AbstractTestBase.java  |    2 +-
 .../OozieProcessMapperLateProcessTest.java         |   42 +++++++--------
 .../falcon/converter/OozieProcessMapperTest.java   |    5 ++-
 5 files changed, 62 insertions(+), 55 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/fcfd9b36/process/src/main/java/org/apache/falcon/converter/OozieProcessMapper.java
----------------------------------------------------------------------
diff --git a/process/src/main/java/org/apache/falcon/converter/OozieProcessMapper.java b/process/src/main/java/org/apache/falcon/converter/OozieProcessMapper.java
index 4e90792..592f089 100644
--- a/process/src/main/java/org/apache/falcon/converter/OozieProcessMapper.java
+++ b/process/src/main/java/org/apache/falcon/converter/OozieProcessMapper.java
@@ -1,4 +1,4 @@
-/*
+/**
  * 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
@@ -44,6 +44,9 @@ import org.apache.hadoop.fs.Path;
 
 import java.util.*;
 
+/**
+ * This class maps the Falcon entities into Oozie artifacts.
+ */
 public class OozieProcessMapper extends AbstractOozieEntityMapper<Process> {
 
     private static final String DEFAULT_WF_TEMPLATE = "/config/workflow/process-parent-workflow.xml";
@@ -76,7 +79,7 @@ public class OozieProcessMapper extends AbstractOozieEntityMapper<Process>
{
     }
 
     /**
-     * Creates default oozie coordinator
+     * Creates default oozie coordinator.
      *
      * @param cluster    - Cluster for which the coordiantor app need to be created
      * @param bundlePath - bundle path
@@ -108,21 +111,20 @@ public class OozieProcessMapper extends AbstractOozieEntityMapper<Process>
{
         controls.setExecution(process.getOrder().name());
 
         Frequency timeout = process.getTimeout();
-        long frequency_ms = ExpressionHelper.get().
-                evaluate(process.getFrequency().toString(), Long.class);
-        long timeout_ms;
+        long frequencyInMillis = ExpressionHelper.get().evaluate(process.getFrequency().toString(),
Long.class);
+        long timeoutInMillis;
         if (timeout != null) {
-            timeout_ms = ExpressionHelper.get().
+            timeoutInMillis = ExpressionHelper.get().
                     evaluate(process.getTimeout().toString(), Long.class);
         } else {
-            timeout_ms = frequency_ms * 6;
-            if (timeout_ms < THIRTY_MINUTES) {
-                timeout_ms = THIRTY_MINUTES;
+            timeoutInMillis = frequencyInMillis * 6;
+            if (timeoutInMillis < THIRTY_MINUTES) {
+                timeoutInMillis = THIRTY_MINUTES;
             }
         }
-        controls.setTimeout(String.valueOf(timeout_ms / (1000 * 60)));
-        if (timeout_ms / frequency_ms * 2 > 0) {
-            controls.setThrottle(String.valueOf(timeout_ms / frequency_ms * 2));
+        controls.setTimeout(String.valueOf(timeoutInMillis / (1000 * 60)));
+        if (timeoutInMillis / frequencyInMillis * 2 > 0) {
+            controls.setThrottle(String.valueOf(timeoutInMillis / frequencyInMillis * 2));
         }
         coord.setControls(controls);
 
@@ -229,10 +231,10 @@ public class OozieProcessMapper extends AbstractOozieEntityMapper<Process>
{
         return datain;
     }
 
+    //SUSPEND CHECKSTYLE CHECK VisibilityModifierCheck
     private void createOutputEvent(String feed, String name, Cluster cluster,
                                    String type, LocationType locType, COORDINATORAPP coord,
-                                   Map<String, String> props, String instance)
-            throws FalconException {
+                                   Map<String, String> props, String instance) throws
FalconException {
         SYNCDATASET dataset = createDataSet(feed, cluster, name + type,
                 locType);
         coord.getDatasets().getDatasetOrAsyncDataset().add(dataset);
@@ -247,6 +249,7 @@ public class OozieProcessMapper extends AbstractOozieEntityMapper<Process>
{
         String outputExpr = "${coord:dataOut('" + name + type + "')}";
         props.put(name + "." + type, outputExpr);
     }
+    //RESUME CHECKSTYLE CHECK VisibilityModifierCheck
 
     private String join(Iterator<String> itr, char sep) {
         String joinedStr = StringUtils.join(itr, sep);
@@ -256,8 +259,8 @@ public class OozieProcessMapper extends AbstractOozieEntityMapper<Process>
{
         return joinedStr;
     }
 
-    private SYNCDATASET createDataSet(String feedName, Cluster cluster, String datasetName,
LocationType locationType)
-            throws FalconException {
+    private SYNCDATASET createDataSet(String feedName, Cluster cluster, String datasetName,
+                                      LocationType locationType) throws FalconException {
         Feed feed = (Feed) EntityUtil.getEntity(EntityType.FEED, feedName);
 
         SYNCDATASET syncdataset = new SYNCDATASET();

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/fcfd9b36/process/src/main/java/org/apache/falcon/workflow/OozieProcessWorkflowBuilder.java
----------------------------------------------------------------------
diff --git a/process/src/main/java/org/apache/falcon/workflow/OozieProcessWorkflowBuilder.java
b/process/src/main/java/org/apache/falcon/workflow/OozieProcessWorkflowBuilder.java
index e422ec4..3f70557 100644
--- a/process/src/main/java/org/apache/falcon/workflow/OozieProcessWorkflowBuilder.java
+++ b/process/src/main/java/org/apache/falcon/workflow/OozieProcessWorkflowBuilder.java
@@ -1,4 +1,4 @@
-/*
+/**
  * 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
@@ -41,6 +41,9 @@ import org.apache.oozie.client.OozieClient;
 
 import java.util.*;
 
+/**
+ * Oozie workflow builder for falcon entities.
+ */
 public class OozieProcessWorkflowBuilder extends OozieWorkflowBuilder<Process> {
 
     @Override
@@ -59,7 +62,7 @@ public class OozieProcessWorkflowBuilder extends OozieWorkflowBuilder<Process>
{
     }
 
     private void addOptionalInputProperties(Properties properties, Input in, String clusterName)
-            throws FalconException {
+        throws FalconException {
         Feed feed = EntityUtil.getEntity(EntityType.FEED, in.getFeed());
         org.apache.falcon.entity.v0.feed.Cluster cluster = FeedHelper.getCluster(feed, clusterName);
         String inName = in.getName();
@@ -80,28 +83,28 @@ public class OozieProcessWorkflowBuilder extends OozieWorkflowBuilder<Process>
{
 
     private Timeunit mapToCoordTimeUnit(TimeUnit tu) {
         switch (tu) {
-            case days:
-                return Timeunit.DAY;
+        case days:
+            return Timeunit.DAY;
+
+        case hours:
+            return Timeunit.HOUR;
 
-            case hours:
-                return Timeunit.HOUR;
+        case minutes:
+            return Timeunit.MINUTE;
 
-            case minutes:
-                return Timeunit.MINUTE;
+        case months:
+            return Timeunit.MONTH;
 
-            case months:
-                return Timeunit.MONTH;
+        default:
+            throw new IllegalArgumentException("Unhandled time unit " + tu);
         }
-        throw new IllegalArgumentException("Unhandled time unit " + tu);
     }
 
     @Override
     public Properties newWorkflowSchedule(Process process, Date startDate, String clusterName,
String user)
-            throws FalconException {
+        throws FalconException {
         org.apache.falcon.entity.v0.process.Cluster processCluster = ProcessHelper.getCluster(process,
clusterName);
-        if (!startDate.before(processCluster.getValidity().getEnd()))
-        // start time >= end time
-        {
+        if (!startDate.before(processCluster.getValidity().getEnd())) {// start time >=
end time
             return null;
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/fcfd9b36/process/src/test/java/org/apache/falcon/converter/AbstractTestBase.java
----------------------------------------------------------------------
diff --git a/process/src/test/java/org/apache/falcon/converter/AbstractTestBase.java b/process/src/test/java/org/apache/falcon/converter/AbstractTestBase.java
index 4a0f7c4..9cc02df 100644
--- a/process/src/test/java/org/apache/falcon/converter/AbstractTestBase.java
+++ b/process/src/test/java/org/apache/falcon/converter/AbstractTestBase.java
@@ -34,7 +34,6 @@ public class AbstractTestBase {
     private static final String FEED_XML = "/config/feed/feed-0.1.xml";
     private static final String CLUSTER_XML = "/config/cluster/cluster-0.1.xml";
 
-
     private void storeEntity(EntityType type, String name) throws Exception {
         Unmarshaller unmarshaller = type.getUnmarshaller();
         ConfigurationStore store = ConfigurationStore.get();
@@ -57,6 +56,7 @@ public class AbstractTestBase {
             process.setName(name);
             store.publish(type, process);
             break;
+
         default:
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/fcfd9b36/process/src/test/java/org/apache/falcon/converter/OozieProcessMapperLateProcessTest.java
----------------------------------------------------------------------
diff --git a/process/src/test/java/org/apache/falcon/converter/OozieProcessMapperLateProcessTest.java
b/process/src/test/java/org/apache/falcon/converter/OozieProcessMapperLateProcessTest.java
index d7fb4b0..34bfe7f 100644
--- a/process/src/test/java/org/apache/falcon/converter/OozieProcessMapperLateProcessTest.java
+++ b/process/src/test/java/org/apache/falcon/converter/OozieProcessMapperLateProcessTest.java
@@ -1,4 +1,4 @@
-/*
+/**
  * 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
@@ -30,18 +30,20 @@ import org.apache.hadoop.conf.Configuration;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
 
+/**
+ * Test class for late data processing.
+ */
 public class OozieProcessMapperLateProcessTest {
 
-    private static String hdfsUrl;
     private static final String CLUSTER_XML = "/config/late/late-cluster.xml";
     private static final String FEED1_XML = "/config/late/late-feed1.xml";
     private static final String FEED2_XML = "/config/late/late-feed2.xml";
     private static final String FEED3_XML = "/config/late/late-feed3.xml";
     private static final String PROCESS1_XML = "/config/late/late-process1.xml";
     private static final String PROCESS2_XML = "/config/late/late-process2.xml";
-    private static final ConfigurationStore store = ConfigurationStore.get();
+    private static final ConfigurationStore STORE = ConfigurationStore.get();
+
     private static EmbeddedCluster dfsCluster;
-    private static Configuration conf;
 
     @BeforeClass
     public void setUpDFS() throws Exception {
@@ -49,14 +51,14 @@ public class OozieProcessMapperLateProcessTest {
         cleanupStore();
 
         dfsCluster = EmbeddedCluster.newCluster("testCluster", false);
-        conf = dfsCluster.getConf();
-        hdfsUrl = conf.get("fs.default.name");
+        Configuration conf = dfsCluster.getConf();
+        String hdfsUrl = conf.get("fs.default.name");
 
         Cluster cluster = (Cluster) EntityType.CLUSTER.getUnmarshaller()
                 .unmarshal(this.getClass().getResource(CLUSTER_XML));
         ClusterHelper.getInterface(cluster, Interfacetype.WRITE).setEndpoint(hdfsUrl);
 
-        store.publish(EntityType.CLUSTER, cluster);
+        STORE.publish(EntityType.CLUSTER, cluster);
 
         Feed feed1 = (Feed) EntityType.FEED.getUnmarshaller().unmarshal(
                 this.getClass().getResource(FEED1_XML));
@@ -65,34 +67,30 @@ public class OozieProcessMapperLateProcessTest {
         Feed feed3 = (Feed) EntityType.FEED.getUnmarshaller().unmarshal(
                 this.getClass().getResource(FEED3_XML));
 
-        store.publish(EntityType.FEED, feed1);
-        store.publish(EntityType.FEED, feed2);
-        store.publish(EntityType.FEED, feed3);
+        STORE.publish(EntityType.FEED, feed1);
+        STORE.publish(EntityType.FEED, feed2);
+        STORE.publish(EntityType.FEED, feed3);
 
         Process process1 = (Process) EntityType.PROCESS.getUnmarshaller()
                 .unmarshal(this.getClass().getResource(PROCESS1_XML));
-        store.publish(EntityType.PROCESS, process1);
+        STORE.publish(EntityType.PROCESS, process1);
         Process process2 = (Process) EntityType.PROCESS.getUnmarshaller()
                 .unmarshal(this.getClass().getResource(PROCESS2_XML));
-        store.publish(EntityType.PROCESS, process2);
-
+        STORE.publish(EntityType.PROCESS, process2);
     }
 
     private void cleanupStore() throws FalconException {
-        store.remove(EntityType.PROCESS, "late-process1");
-        store.remove(EntityType.PROCESS, "late-process2");
-        store.remove(EntityType.FEED, "late-feed1");
-        store.remove(EntityType.FEED, "late-feed2");
-        store.remove(EntityType.FEED, "late-feed3");
-        store.remove(EntityType.CLUSTER, "late-cluster");
-
+        STORE.remove(EntityType.PROCESS, "late-process1");
+        STORE.remove(EntityType.PROCESS, "late-process2");
+        STORE.remove(EntityType.FEED, "late-feed1");
+        STORE.remove(EntityType.FEED, "late-feed2");
+        STORE.remove(EntityType.FEED, "late-feed3");
+        STORE.remove(EntityType.CLUSTER, "late-cluster");
     }
 
-
     @AfterClass
     public void tearDown() throws Exception {
         cleanupStore();
         dfsCluster.shutdown();
     }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/fcfd9b36/process/src/test/java/org/apache/falcon/converter/OozieProcessMapperTest.java
----------------------------------------------------------------------
diff --git a/process/src/test/java/org/apache/falcon/converter/OozieProcessMapperTest.java
b/process/src/test/java/org/apache/falcon/converter/OozieProcessMapperTest.java
index 3106920..9ed7baf 100644
--- a/process/src/test/java/org/apache/falcon/converter/OozieProcessMapperTest.java
+++ b/process/src/test/java/org/apache/falcon/converter/OozieProcessMapperTest.java
@@ -1,4 +1,4 @@
-/*
+/**
  * 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
@@ -62,6 +62,9 @@ import java.io.InputStreamReader;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertTrue;
 
+/**
+ * Test for the Falcon entities mapping into Oozie artifacts.
+ */
 public class OozieProcessMapperTest extends AbstractTestBase {
 
     private String hdfsUrl;


Mime
View raw message