You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@slider.apache.org by sm...@apache.org on 2014/05/28 04:21:16 UTC

[11/44] git commit: SLIDER 74. Allow package description to be longer than 100 chars

SLIDER 74. Allow package description to be longer than 100 chars


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

Branch: refs/heads/master
Commit: 764c68a91acba9bc4c1627938f7397c431e3934d
Parents: f3dd43f
Author: Sumit Mohanty <sm...@hortonworks.com>
Authored: Wed May 21 19:01:46 2014 -0700
Committer: Sumit Mohanty <sm...@hortonworks.com>
Committed: Wed May 21 19:01:46 2014 -0700

----------------------------------------------------------------------
 app-packages/accumulo-v1_5/metainfo.xml         |  8 +++++++-
 app-packages/hbase-v0_96/README.txt             |  4 ++--
 app-packages/hbase-v0_96/metainfo.xml           |  6 ++++--
 .../apache/slider/common/tools/SliderUtils.java | 21 ++++++++++++++++++++
 .../providers/agent/AgentClientProvider.java    |  2 +-
 .../slider/common/tools/TestSliderUtils.java    | 18 +++++++++++++++--
 6 files changed, 51 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/764c68a9/app-packages/accumulo-v1_5/metainfo.xml
----------------------------------------------------------------------
diff --git a/app-packages/accumulo-v1_5/metainfo.xml b/app-packages/accumulo-v1_5/metainfo.xml
index 244632c..09ab9c4 100644
--- a/app-packages/accumulo-v1_5/metainfo.xml
+++ b/app-packages/accumulo-v1_5/metainfo.xml
@@ -21,7 +21,13 @@
     <service>
       <name>ACCUMULO</name>
       <comment>
-        The Apache Accumulo is a robust, scalable, high performance data storage system.
+        The Apache Accumulo sorted, distributed key/value store is a robust,
+        scalable, high performance data storage system that features cell-based
+        access control and customizable server-side processing. It is based on
+        Google's BigTable design and is built on top of Apache Hadoop,
+        Zookeeper, and Thrift.
+        Requirements:
+        1. Ensure parent dir for path (accumulo-site/instance.dfs.dir) is accessible to the App owner.
       </comment>
       <version>1.5.1</version>
       <exportGroups>

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/764c68a9/app-packages/hbase-v0_96/README.txt
----------------------------------------------------------------------
diff --git a/app-packages/hbase-v0_96/README.txt b/app-packages/hbase-v0_96/README.txt
index 972f3c0..d7d8ff7 100644
--- a/app-packages/hbase-v0_96/README.txt
+++ b/app-packages/hbase-v0_96/README.txt
@@ -5,10 +5,10 @@ Replace the placeholder tarball for Accumulo.
   rm package/files/hbase-0.96.1-hadoop2-bin.tar.gz.REPLACE
 
 Create a zip package at the root of the package (<slider enlistment>/app-packages/hbase-v0_96/) 
-  zip -r hbase-v096.zip .
+  zip -r hbase_v096.zip .
 
 Verify the content using  
-  unzip -l "$@" hbase-v096.zip
+  unzip -l "$@" hbase_v096.zip
 
 While appConfig.json and resources.json are not required for the package they work
 well as the default configuration for Slider apps. So its advisable that when you

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/764c68a9/app-packages/hbase-v0_96/metainfo.xml
----------------------------------------------------------------------
diff --git a/app-packages/hbase-v0_96/metainfo.xml b/app-packages/hbase-v0_96/metainfo.xml
index 6a45818..e5bcdc9 100644
--- a/app-packages/hbase-v0_96/metainfo.xml
+++ b/app-packages/hbase-v0_96/metainfo.xml
@@ -21,8 +21,10 @@
     <service>
       <name>HBASE</name>
       <comment>
-        Apache HBase is the Hadoop database, a distributed, scalable, big data
-        store.
+        Apache HBase is the Hadoop database, a distributed, scalable, big data store.
+        Requirements:
+        1. Ensure parent dir for path (hbase-site/hbase.rootdir) is accessible to the App owner.
+        2. Ensure ZK root (hbase-site/zookeeper.znode.parent) is unique for the App instance.
       </comment>
       <version>0.96.0.2.1.1</version>
       <type>YARN-APP</type>

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/764c68a9/slider-core/src/main/java/org/apache/slider/common/tools/SliderUtils.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/common/tools/SliderUtils.java b/slider-core/src/main/java/org/apache/slider/common/tools/SliderUtils.java
index bdc381e..0cfb569 100644
--- a/slider-core/src/main/java/org/apache/slider/common/tools/SliderUtils.java
+++ b/slider-core/src/main/java/org/apache/slider/common/tools/SliderUtils.java
@@ -1358,6 +1358,27 @@ public final class SliderUtils {
     }
     return result;
   }
+
+
+  /**
+   * Truncate the given string to a maximum length provided
+   * with a pad (...) added to the end if expected size if more than 10.
+   * @param toTruncate
+   * @param maxSize
+   * @return
+   */
+  public static String truncate(String toTruncate, int maxSize) {
+    if(toTruncate == null || maxSize < 1
+       || toTruncate.length() <= maxSize) {
+      return toTruncate;
+    }
+
+    String pad = "...";
+    if(maxSize < 10) {
+      pad = "";
+    }
+    return toTruncate.substring(0, maxSize - pad.length()).concat(pad);
+  }
   
   
   /**

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/764c68a9/slider-core/src/main/java/org/apache/slider/providers/agent/AgentClientProvider.java
----------------------------------------------------------------------
diff --git a/slider-core/src/main/java/org/apache/slider/providers/agent/AgentClientProvider.java b/slider-core/src/main/java/org/apache/slider/providers/agent/AgentClientProvider.java
index 9f082f8..1946ebd 100644
--- a/slider-core/src/main/java/org/apache/slider/providers/agent/AgentClientProvider.java
+++ b/slider-core/src/main/java/org/apache/slider/providers/agent/AgentClientProvider.java
@@ -208,7 +208,7 @@ public class AgentClientProvider extends AbstractClientProvider
       tags = new HashSet<>();
       tags.add("Name: " + service.getName());
       tags.add("Version: " + service.getVersion());
-      tags.add("Description: " + service.getComment());
+      tags.add("Description: " + SliderUtils.truncate(service.getComment(), 80));
     } catch (IOException e) {
       log.error("error retrieving metainfo from {}", appDef, e);
       throw new SliderException("error retrieving metainfo", e);

http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/764c68a9/slider-core/src/test/java/org/apache/slider/common/tools/TestSliderUtils.java
----------------------------------------------------------------------
diff --git a/slider-core/src/test/java/org/apache/slider/common/tools/TestSliderUtils.java b/slider-core/src/test/java/org/apache/slider/common/tools/TestSliderUtils.java
index 863a1e6..7cac439 100644
--- a/slider-core/src/test/java/org/apache/slider/common/tools/TestSliderUtils.java
+++ b/slider-core/src/test/java/org/apache/slider/common/tools/TestSliderUtils.java
@@ -20,6 +20,7 @@ import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.junit.Test;
+import org.junit.Assert;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -44,7 +45,20 @@ public class TestSliderUtils {
         sliderFileSystem.getFileSystem(),
         new Path("target/test-classes/org/apache/slider/common/tools/test.zip"),
         "metainfo.xml");
-    assert stream != null;
-    assert stream.available() > 0;
+    Assert.assertTrue(stream != null);
+    Assert.assertTrue(stream.available() > 0);
+  }
+
+  @Test
+  public void testTruncate () {
+    Assert.assertEquals(SliderUtils.truncate(null, 5), null);
+    Assert.assertEquals(SliderUtils.truncate("323", -1), "323");
+    Assert.assertEquals(SliderUtils.truncate("3232", 5), "3232");
+    Assert.assertEquals(SliderUtils.truncate("1234567890", 0), "1234567890");
+    Assert.assertEquals(SliderUtils.truncate("123456789012345", 15), "123456789012345");
+    Assert.assertEquals(SliderUtils.truncate("123456789012345", 14), "12345678901...");
+    Assert.assertEquals(SliderUtils.truncate("1234567890", 1), "1");
+    Assert.assertEquals(SliderUtils.truncate("1234567890", 10), "1234567890");
+    Assert.assertEquals(SliderUtils.truncate("", 10), "");
   }
 }