Merge remote branch 'origin/master' into wosch
authorWolfram Schneider <wosch@indexdata.dk>
Mon, 7 Apr 2014 16:04:18 +0000 (16:04 +0000)
committerWolfram Schneider <wosch@indexdata.dk>
Mon, 7 Apr 2014 16:04:18 +0000 (16:04 +0000)
12 files changed:
Makefile
examples/htdocs/Makefile
examples/htdocs/jasmine-local-popup.html
examples/htdocs/jasmine-popup.html
examples/htdocs/jasmine.html
test/Makefile
test/bin/apache-template-update [new file with mode: 0755]
test/bin/bomb.pl [new file with mode: 0755]
test/bomb.pl [deleted file]
test/bomp.pl [deleted file]
test/logs/.gitkeep [new file with mode: 0644]
tools/apache2/jasmine-dev.template [new file with mode: 0644]

index b3e4fab..e37daa0 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -19,7 +19,6 @@ phantomjs:
 # must be called once after GIT checkout
 setup: 
 #why?  ${MAKE} -C./tools/htdocs mkws-js-min
-       ${MAKE} -C./examples/htdocs jasmine-links
        ${MAKE} -C./test node-modules
 
 check: setup check-js
index 26bbafe..683cb0e 100644 (file)
@@ -8,8 +8,6 @@ apache-config.txt: ../apache2/mkws-examples-mike
        chmod ugo-w $@
 
 jasmine-links:
-       ln -fs ../jasmine .
-       ln -fs ../../test .
 
 help:
        @echo "make [ all | clean | jasmine-links ]"
index 8678a01..6b2ec55 100644 (file)
@@ -6,13 +6,13 @@
     <link rel="stylesheet" type="text/css" href="//code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
     <link rel="stylesheet" type="text/css" href="tools/htdocs/mkws.css" />
 
-    <script type="text/javascript" src="tools/htdocs/jquery-1.10.0.min.js"></script>
+    <script type="text/javascript" src="src/jquery-1.10.0.min.js"></script>
     <script type="text/javascript" src="//code.jquery.com/ui/1.10.3/jquery-ui.min.js"></script>
-    <script type="text/javascript" src="tools/htdocs/pz2.js"></script>
-    <script type="text/javascript" src="tools/htdocs/jquery.json-2.4.js"></script>
-    <script type="text/javascript" src="tools/htdocs/handlebars-v1.1.2.js"></script>
-    <script type="text/javascript" src="tools/htdocs/mkws.js"></script>
-    <script type="text/javascript" src="tools/htdocs/mkws-jquery.js"></script>
+    <script type="text/javascript" src="src/pz2.js"></script>
+    <script type="text/javascript" src="src/jquery.json-2.4.js"></script>
+    <script type="text/javascript" src="src/handlebars-v1.1.2.js"></script>
+    <script type="text/javascript" src="src/mkws.js"></script>
+    <script type="text/javascript" src="src/mkws-jquery.js"></script>
 
     <link rel="shortcut icon" type="image/png" href="jasmine/lib/jasmine-1.3.1/jasmine_favicon.png">
     <link rel="stylesheet" type="text/css" href="jasmine/lib/jasmine-1.3.1/jasmine.css">
index f979e63..1ef798e 100644 (file)
@@ -6,13 +6,13 @@
     <link rel="stylesheet" type="text/css" href="//code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
     <link rel="stylesheet" type="text/css" href="tools/htdocs/mkws.css" />
 
-    <script type="text/javascript" src="tools/htdocs/jquery-1.10.0.min.js"></script>
+    <script type="text/javascript" src="src/jquery-1.10.0.min.js"></script>
     <script type="text/javascript" src="//code.jquery.com/ui/1.10.3/jquery-ui.min.js"></script>
-    <script type="text/javascript" src="tools/htdocs/pz2.js"></script>
-    <script type="text/javascript" src="tools/htdocs/jquery.json-2.4.js"></script>
-    <script type="text/javascript" src="tools/htdocs/handlebars-v1.1.2.js"></script>
-    <script type="text/javascript" src="tools/htdocs/mkws.js"></script>
-    <script type="text/javascript" src="tools/htdocs/mkws-jquery.js"></script>
+    <script type="text/javascript" src="src/pz2.js"></script>
+    <script type="text/javascript" src="src/jquery.json-2.4.js"></script>
+    <script type="text/javascript" src="src/handlebars-v1.1.2.js"></script>
+    <script type="text/javascript" src="src/mkws.js"></script>
+    <script type="text/javascript" src="src/mkws-jquery.js"></script>
 
     <link rel="shortcut icon" type="image/png" href="jasmine/lib/jasmine-1.3.1/jasmine_favicon.png">
     <link rel="stylesheet" type="text/css" href="jasmine/lib/jasmine-1.3.1/jasmine.css">
index 4de368e..88ed19d 100644 (file)
       };
     </script>
     <script type="text/javascript" src="//code.jquery.com/jquery-1.7.2.min.js"></script> 
-    <script type="text/javascript" src="tools/htdocs/pz2.js"></script>
-    <script type="text/javascript" src="tools/htdocs/handlebars-v1.1.2.js"></script>
-    <script type="text/javascript" src="tools/htdocs/jquery.json-2.4.js"></script>
-    <script type="text/javascript" src="tools/htdocs/mkws.js"></script>
+    <script type="text/javascript" src="src/pz2.js"></script>
+    <script type="text/javascript" src="src/handlebars-v1.1.2.js"></script>
+    <script type="text/javascript" src="src/jquery.json-2.4.js"></script>
+    <script type="text/javascript" src="src/mkws.js"></script>
     <style type="text/css">
       #mkwsTermlists div.facet {
       float:left;
index 2868490..d4033ec 100644 (file)
@@ -3,7 +3,8 @@
 # For running on Mike's local install of node.js
 MIKE = PATH=$$PATH:/usr/local/lib/node-v0.10.24-linux-x64/bin
 
-PHANTOMJS_URL=https://mkws-dev.indexdata.com/jasmine-popup.html        
+#PHANTOMJS_URL=https://mkws-dev.indexdata.com/jasmine-popup.html       
+PHANTOMJS_URL=http://localhost:4040/jasmine-popup.html
 PHANTOMJS_TIMEOUT=16
 
 NPM_INSTALL_FLAGS=-q
@@ -11,15 +12,23 @@ JASMINE_NODE=       ./node_modules/jasmine-node/bin/jasmine-node
 PHANTOMJS=     ./node_modules/phantomjs/bin/phantomjs
 IMAGES=        ./images
 SCREENSHOT_WIDTH=      360 480 640 768 1024 1200 1440 2048
-PERL_SCRIPTS=  bomb.pl
+PERL_SCRIPTS=  bin/bomb.pl
+TMP_DIR=       ./logs
+APACHE_HTTPD=  /usr/sbin/apache2
 
 all: check
 
 clean:
        rm -f mkws-error.png mkws-error.html images/*.png
 
-distclean: clean
+distclean: clean clean-tmp
        rm -rf node_modules
+       rm -f ${TMP_DIR}/jasmine-dev
+
+clean-tmp:
+       rm -rf ${TMP_DIR}
+       mkdir -p ${TMP_DIR}
+       touch ${TMP_DIR}/.gitkeep
 
 mkws-complete-syntax-check:
        ${MAKE} -C../src mkws-complete.min.js
@@ -33,8 +42,9 @@ test: check
 terse:
        $(MIKE) jasmine-node --noColor --captureExceptions --forceexit spec
 
-phantomjs p:
-       ./bomb.pl --timeout="${PHANTOMJS_TIMEOUT}.5" ${PHANTOMJS} phantom/run-jasmine.js ${PHANTOMJS_URL} ${PHANTOMJS_TIMEOUT}
+phantomjs p: apache-stop apache-start
+       ./bin/bomb.pl --timeout="${PHANTOMJS_TIMEOUT}.5" ${PHANTOMJS} phantom/run-jasmine.js ${PHANTOMJS_URL} ${PHANTOMJS_TIMEOUT}
+       ${MAKE} apache-stop
 
 screenshot:
        ${PHANTOMJS} phantom/screenshot.js ${PHANTOMJS_URL} ${IMAGES}/screenshot.png 1200 1000
@@ -64,11 +74,24 @@ perltidy:
 node_modules node-modules:
        npm install ${NPM_INSTALL_FLAGS}
 
+apache-start:
+       bin/apache-template-update
+       ${APACHE_HTTPD} -f `pwd`/${TMP_DIR}/jasmine-dev
+       
+apache-stop:
+       @-if [ -e ${TMP_DIR}/mkws-jasmine.pid ]; then \
+          kill `cat ${TMP_DIR}/mkws-jasmine.pid`; \
+       else \
+          killall apache2 2> /dev/null; \
+       fi
+       @sleep 0.3
+
 help:
        @echo "make [ all | check | clean | distclean ]"
        @echo "     [ phantomjs | screenshot ]"
        @echo "     [ jsbeautifier | perltidy ]"
        @echo "     [ node-modules ]"
+       @echo "     [ apache-stop apache-start ]"
        @echo ""
-       @echo "DEBUG=1 make phantomjs PHANTOMJS_TIMEOUT=8 PHANTOMJS_URL=https://mkws-dev.indexdata.com/jasmine-popup.html"
+       @echo "DEBUG=1 make phantomjs PHANTOMJS_TIMEOUT=8 PHANTOMJS_URL=${PHANTOMJS_URL}"
 
diff --git a/test/bin/apache-template-update b/test/bin/apache-template-update
new file mode 100755 (executable)
index 0000000..0ad5bc9
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+# Copyright (c) 2014-2014 IndexData ApS. http://indexdata.com
+# Wolfram Schneider
+#
+# generate temp config file for testing
+#
+
+export APACHE_SERVER_ROOT=$(pwd)
+export APACHE_RUN_USER=$(whoami)
+export APACHE_RUN_GROUP=$(groups | awk '{ print $1 }')
+
+export APACHE_LOG_DIR=$APACHE_SERVER_ROOT/logs
+export APACHE_PID_FILE=$APACHE_LOG_DIR/mkws-jasmine.pid
+export APACHE_PORT=4040
+
+export MKWS_ROOT=$(pwd)/..
+
+: ${MKWS_APACHE_TEMPLATE="$MKWS_ROOT/tools/apache2/jasmine-dev.template"}
+: ${MKWS_APACHE_FILE="$APACHE_LOG_DIR/jasmine-dev"}
+
+perl -npe 's,\${(.*?)},$ENV{$1},g; ' $MKWS_APACHE_TEMPLATE > $MKWS_APACHE_FILE.tmp
+mv -f $MKWS_APACHE_FILE.tmp $MKWS_APACHE_FILE
+
diff --git a/test/bin/bomb.pl b/test/bin/bomb.pl
new file mode 100755 (executable)
index 0000000..f4b4cec
--- /dev/null
@@ -0,0 +1,73 @@
+#!/usr/bin/perl
+# Copyright (c) 2014 IndexData ApS. http://indexdata.com
+#
+# bomb.pl - wrapper to stop a process after N seconds
+#
+
+use Getopt::Long;
+
+use strict;
+use warnings;
+
+my $debug = 0;
+my $help;
+my $timeout = 100;
+
+binmode \*STDOUT, ":utf8";
+binmode \*STDERR, ":utf8";
+
+# timeout handler
+sub set_alarm {
+    my $time = shift;
+    my $message = shift || "";
+
+    $time = 100 if !defined $time;
+
+    $SIG{ALRM} = sub {
+
+        warn "Time out alarm $time\n";
+
+        # sends a hang-up signal to all processes in the current process group
+        # and kill running java processes
+        local $SIG{HUP} = "IGNORE";
+        kill 1, -$$;
+
+        local $SIG{TERM} = "IGNORE";
+        kill 15, -$$;
+        kill 15, -$$;
+
+        warn "Send a hang-up to all childs.\n";
+
+        #exit 1;
+    };
+
+    warn "set alarm time to: $time seconds $message\n" if $debug >= 1;
+    alarm($time);
+}
+
+sub usage () {
+    <<EOF;
+usage: $0 [ options ] command args ....
+
+--debug=0..3    debug option, default: $debug
+--timeout=1..N  timeout in seconds, default: $timeout
+EOF
+}
+
+GetOptions(
+    "help"      => \$help,
+    "debug=i"   => \$debug,
+    "timeout=f" => \$timeout,
+) or die usage;
+
+my @system = @ARGV;
+
+die usage if $help;
+die usage if !@system;
+
+set_alarm( $timeout, join( " ", @system ) );
+
+system(@system) == 0
+  or die "@system failed with exit code: $?\n";
+
+exit(0);
diff --git a/test/bomb.pl b/test/bomb.pl
deleted file mode 100755 (executable)
index f4b4cec..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/usr/bin/perl
-# Copyright (c) 2014 IndexData ApS. http://indexdata.com
-#
-# bomb.pl - wrapper to stop a process after N seconds
-#
-
-use Getopt::Long;
-
-use strict;
-use warnings;
-
-my $debug = 0;
-my $help;
-my $timeout = 100;
-
-binmode \*STDOUT, ":utf8";
-binmode \*STDERR, ":utf8";
-
-# timeout handler
-sub set_alarm {
-    my $time = shift;
-    my $message = shift || "";
-
-    $time = 100 if !defined $time;
-
-    $SIG{ALRM} = sub {
-
-        warn "Time out alarm $time\n";
-
-        # sends a hang-up signal to all processes in the current process group
-        # and kill running java processes
-        local $SIG{HUP} = "IGNORE";
-        kill 1, -$$;
-
-        local $SIG{TERM} = "IGNORE";
-        kill 15, -$$;
-        kill 15, -$$;
-
-        warn "Send a hang-up to all childs.\n";
-
-        #exit 1;
-    };
-
-    warn "set alarm time to: $time seconds $message\n" if $debug >= 1;
-    alarm($time);
-}
-
-sub usage () {
-    <<EOF;
-usage: $0 [ options ] command args ....
-
---debug=0..3    debug option, default: $debug
---timeout=1..N  timeout in seconds, default: $timeout
-EOF
-}
-
-GetOptions(
-    "help"      => \$help,
-    "debug=i"   => \$debug,
-    "timeout=f" => \$timeout,
-) or die usage;
-
-my @system = @ARGV;
-
-die usage if $help;
-die usage if !@system;
-
-set_alarm( $timeout, join( " ", @system ) );
-
-system(@system) == 0
-  or die "@system failed with exit code: $?\n";
-
-exit(0);
diff --git a/test/bomp.pl b/test/bomp.pl
deleted file mode 100644 (file)
index a84f40b..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/usr/local/bin/perl
-# Copyright (c) 2014 IndexData ApS. http://indexdata.com
-#
-# bomb.pl - wrapper to stop a process after N seconds
-#
-
-use Getopt::Long;
-
-use strict;
-use warnings;
-
-my $debug = 0;
-my $help;
-my $timeout = 100;
-
-binmode \*STDOUT, ":utf8";
-binmode \*STDERR, ":utf8";
-
-# timeout handler
-sub set_alarm {
-    my $time = shift;
-    my $message = shift || "";
-
-    $time = 100 if !defined $time;
-
-    $SIG{ALRM} = sub {
-
-        warn "Time out alarm $time\n";
-
-        # sends a hang-up signal to all processes in the current process group
-        # and kill running java processes
-        local $SIG{HUP} = "IGNORE";
-        kill 1, -$$;
-
-        local $SIG{TERM} = "IGNORE";
-        kill 15, -$$;
-        kill 15, -$$;
-
-        warn "Send a hang-up to all childs.\n";
-
-        #exit 1;
-    };
-
-    warn "set alarm time to: $time seconds $message\n" if $debug >= 1;
-    alarm($time);
-}
-
-sub usage () {
-    <<EOF;
-usage: $0 [ options ] command args ....
-
---debug=0..3    debug option, default: $debug
---timeout=1..N  timeout in seconds, default: $timeout
-EOF
-}
-
-GetOptions(
-    "help"      => \$help,
-    "debug=i"   => \$debug,
-    "timeout=i" => \$timeout,
-) or die usage;
-
-my @system = @ARGV;
-
-die usage if $help;
-die usage if !@system;
-
-set_alarm( $timeout, join( " ", @system ) );
-
-system(@system) == 0
-  or die "system @system failed: $?";
-
-exit(0);
diff --git a/test/logs/.gitkeep b/test/logs/.gitkeep
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/tools/apache2/jasmine-dev.template b/tools/apache2/jasmine-dev.template
new file mode 100644 (file)
index 0000000..86c297a
--- /dev/null
@@ -0,0 +1,72 @@
+# Configuration for the apache web server                 -*- apache -*-
+
+#####################################################################
+# global apache2 config
+#
+User ${APACHE_RUN_USER}
+Group ${APACHE_RUN_GROUP}
+PidFile ${APACHE_PID_FILE}
+
+ServerRoot ${APACHE_SERVER_ROOT}
+NameVirtualHost *:${APACHE_PORT}
+Listen ${APACHE_PORT}
+
+LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
+
+Include /etc/apache2/mods-enabled/alias.load
+Include /etc/apache2/mods-enabled/authz*.load
+Include /etc/apache2/mods-enabled/proxy*.load
+Include /etc/apache2/mods-enabled/rewrite.load
+Include /etc/apache2/mods-enabled/headers.load
+Include /etc/apache2/mods-enabled/mime.load
+Include /etc/apache2/mods-enabled/deflate.load
+
+Include /etc/apache2/mods-enabled/alias*.conf
+Include /etc/apache2/mods-enabled/authz*.conf
+Include /etc/apache2/mods-enabled/proxy*.conf
+Include /etc/apache2/mods-enabled/mime.conf
+Include /etc/apache2/mods-enabled/deflate.conf
+
+# pazpar2 / service proxy config
+<VirtualHost *:${APACHE_PORT}>
+    ServerName localhost
+    ServerAlias mkws-dev a.mkws.indexdata.com a.mkws-dev.indexdata.com mkws-dev.indexdata.com 127.0.0.1
+
+    ServerAdmin webmaster@indexdata.com
+    ErrorLog ${APACHE_LOG_DIR}/mkws-jasmine-error.log
+    CustomLog ${APACHE_LOG_DIR}/mkws-jasmine-access.log combined
+
+    RewriteEngine on
+    RewriteLogLevel 1
+    RewriteLog ${APACHE_LOG_DIR}/mkws-jasmine-rewrite.log 
+
+    DocumentRoot ${MKWS_ROOT}/examples/htdocs
+    Alias /tools/htdocs ${MKWS_ROOT}/tools/htdocs
+    Alias /src ${MKWS_ROOT}/src
+    Alias /test ${MKWS_ROOT}/test
+    Alias /jasmine ${MKWS_ROOT}/examples/jasmine
+
+    # CORS setting
+    Header set Access-Control-Allow-Credentials true
+    Header set Access-Control-Allow-Origin "*"
+
+    # compress text output
+    <Location />
+        AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml
+        SetOutputFilter DEFLATE 
+    </Location> 
+
+    # jasmine test account
+    RewriteRule /service-proxy-testauth  /service-proxy/?command=auth&action=login&username=mkwstest&password=mkwstest [P] # [NE,P]
+
+    # mkws devel account (e.g. memached testing)
+    RewriteRule /service-proxy-auth  /service-proxy/?command=auth&action=login&username=mkwsdev&password=mkwsdev [P] # [NE,P]
+
+    ProxyPass        /service-proxy/ http://mkc.indexdata.com:9009/service-proxy/
+    ProxyPassReverse /service-proxy/ http://mkc.indexdata.com:9009/service-proxy/
+
+    ProxyPass        /pazpar2/         http://localhost:8004/pazpar2/
+    ProxyPassReverse /pazpar2/         http://localhost:8004/pazpar2/
+
+</VirtualHost>
+