Filter Sample Cluster Scripts To Enable Extension

Change-Id: I6f6f27ddcc2311630e8e234ce2770cbb2c66d253
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1044
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <tillw@apache.org>
diff --git a/asterixdb/asterix-server/pom.xml b/asterixdb/asterix-server/pom.xml
index b083bbc..78e990f 100644
--- a/asterixdb/asterix-server/pom.xml
+++ b/asterixdb/asterix-server/pom.xml
@@ -148,8 +148,11 @@
         <executions>
           <execution>
             <configuration>
+              <filters>
+                <filter>${project.basedir}/src/main/assembly/filter.properties</filter>
+              </filters>
               <descriptors>
-                <descriptor>src/main/assembly/binary-assembly.xml</descriptor>
+                <descriptor>${project.basedir}/src/main/assembly/binary-assembly.xml</descriptor>
               </descriptors>
             </configuration>
             <phase>package</phase>
diff --git a/asterixdb/asterix-server/src/main/assembly/binary-assembly.xml b/asterixdb/asterix-server/src/main/assembly/binary-assembly.xml
index 379a6f2..4afde5f 100644
--- a/asterixdb/asterix-server/src/main/assembly/binary-assembly.xml
+++ b/asterixdb/asterix-server/src/main/assembly/binary-assembly.xml
@@ -43,9 +43,21 @@
       <directory>src/main/resources</directory>
       <outputDirectory>.</outputDirectory>
       <includes>
-        <include>LICENSE*</include>
         <include>samples/**</include>
       </includes>
+      <excludes>
+        <exclude>**/*.sh</exclude>
+      </excludes>
+      <filtered>true</filtered>
+    </fileSet>
+    <fileSet>
+      <directory>src/main/resources</directory>
+      <outputDirectory>.</outputDirectory>
+      <includes>
+        <include>samples/**/*.sh</include>
+      </includes>
+      <filtered>true</filtered>
+      <fileMode>0755</fileMode>
     </fileSet>
     <fileSet>
       <directory>target/appassembler/repo</directory>
diff --git a/asterixdb/asterix-server/src/main/assembly/filter.properties b/asterixdb/asterix-server/src/main/assembly/filter.properties
new file mode 100644
index 0000000..301aeaf
--- /dev/null
+++ b/asterixdb/asterix-server/src/main/assembly/filter.properties
@@ -0,0 +1,5 @@
+NC_SERVICE_COMMAND=asterixncservice
+CC_COMMAND=asterixcc
+NC_COMMAND=asterixnc
+LISTEN_PORT=19002
+SHUTDOWN_SERVLET_PATH=admin/shutdown
diff --git a/asterixdb/asterix-server/src/main/resources/samples/local/bin/start-sample-cluster.sh b/asterixdb/asterix-server/src/main/resources/samples/local/bin/start-sample-cluster.sh
index 73358f2..932231f 100755
--- a/asterixdb/asterix-server/src/main/resources/samples/local/bin/start-sample-cluster.sh
+++ b/asterixdb/asterix-server/src/main/resources/samples/local/bin/start-sample-cluster.sh
@@ -54,13 +54,13 @@
   echo "--------------------------"
 ) | tee -a $LOGSDIR/blue-service.log | tee -a $LOGSDIR/red-service.log >> $LOGSDIR/cc.log
 
-$INSTALLDIR/bin/asterixncservice -logdir - -config-file $CLUSTERDIR/conf/blue.conf >> $LOGSDIR/blue-service.log 2>&1 &
-$INSTALLDIR/bin/asterixncservice -logdir - >> $LOGSDIR/red-service.log 2>&1 &
-$INSTALLDIR/bin/asterixcc -config-file $CLUSTERDIR/conf/cc.conf >> $LOGSDIR/cc.log 2>&1 &
+$INSTALLDIR/bin/${NC_SERVICE_COMMAND} -logdir - -config-file $CLUSTERDIR/conf/blue.conf >> $LOGSDIR/blue-service.log 2>&1 &
+$INSTALLDIR/bin/${NC_SERVICE_COMMAND} -logdir - >> $LOGSDIR/red-service.log 2>&1 &
+$INSTALLDIR/bin/${CC_COMMAND} -config-file $CLUSTERDIR/conf/cc.conf >> $LOGSDIR/cc.log 2>&1 &
 
 echo -n "Waiting for cluster to start."
 while [ 1 ]; do
-  curl -s -o /dev/null http://localhost:19002 && break
+  curl -s -o /dev/null http://localhost:${LISTEN_PORT} && break
   echo -n "."
   sleep 1s
 done
diff --git a/asterixdb/asterix-server/src/main/resources/samples/local/bin/stop-sample-cluster.sh b/asterixdb/asterix-server/src/main/resources/samples/local/bin/stop-sample-cluster.sh
index 4a64553..9836cb3 100755
--- a/asterixdb/asterix-server/src/main/resources/samples/local/bin/stop-sample-cluster.sh
+++ b/asterixdb/asterix-server/src/main/resources/samples/local/bin/stop-sample-cluster.sh
@@ -32,7 +32,7 @@
   exit 2
 }
 
-curl -X POST http://localhost:19002/admin/shutdown
+curl -X POST http://localhost:${LISTEN_PORT}/${SHUTDOWN_SERVLET_PATH}
 $JAVA_HOME/bin/jps | awk '/NCService/ { print $1 }' | xargs kill
 echo
 echo -n "Waiting for CCDriver to terminate."
diff --git a/asterixdb/asterix-server/src/main/resources/samples/local/conf/cc.conf b/asterixdb/asterix-server/src/main/resources/samples/local/conf/cc.conf
index 99a97c1c..5ef1cbf 100644
--- a/asterixdb/asterix-server/src/main/resources/samples/local/conf/cc.conf
+++ b/asterixdb/asterix-server/src/main/resources/samples/local/conf/cc.conf
@@ -12,7 +12,7 @@
 [nc]
 storagedir=storage
 address=127.0.0.1
-command=asterixnc
+command=${NC_COMMAND}
 
 [cc]
 cluster.address = 127.0.0.1
diff --git a/asterixdb/pom.xml b/asterixdb/pom.xml
index 8f875ff..4fb3e37 100644
--- a/asterixdb/pom.xml
+++ b/asterixdb/pom.xml
@@ -586,7 +586,7 @@
         <checksumPolicy>warn</checksumPolicy>
       </releases>
       <snapshots>
-        <enabled>true</enabled>
+        <enabled>false</enabled>
         <updatePolicy>always</updatePolicy>
         <checksumPolicy>fail</checksumPolicy>
       </snapshots>