Merge remote branch 'origin/wosch'
authorWolfram Schneider <wosch@indexdata.dk>
Tue, 8 Apr 2014 10:36:29 +0000 (10:36 +0000)
committerWolfram Schneider <wosch@indexdata.dk>
Tue, 8 Apr 2014 10:36:29 +0000 (10:36 +0000)
Conflicts:
test/spec/mkws-pazpar2.js

14 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]
test/spec/mkws-pazpar2.js
tools/apache2/jasmine-dev.template [new file with mode: 0644]
tools/apache2/mkws-dev

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..e7f42ad 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">
@@ -40,6 +40,7 @@
     var jasmine_config = {
       search_query: "netbsd",
       expected_hits: 10,
+      active_clients: 16,
       show_record_url: true
     };
 
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..f92f26b 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-local-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
index b19b71e..cdc3a68 100644 (file)
@@ -9,11 +9,15 @@ var debug = function (text) {
         mkws.log("Jasmine: " + text)
     }
 
-// Define empty jasmine_config for simple applications that don't define it.
+    // Define empty jasmine_config for simple applications that don't define it.
 if (jasmine_config == null || typeof jasmine_config != 'object') {
     var jasmine_config = {};
 }
 
+var jasmine_status = {
+    source_click: 0
+};
+
 /* check config for jasmine test
  *
  * you can override the default values in the config
@@ -203,28 +207,28 @@ describe("Check Termlist", function () {
         expect(termlist.length).toBe(1);
 
         waitsFor(function () {
-            return $('div.mkwsFacet[data-mkws-facet="xtargets"]').length == 1 ? true : false;
+            return $("div.mkwsFacet[data-mkws-facet='xtargets']").length == 1 ? true : false;
         }, "check for facet sources", 4 * jasmine_config.second);
 
         // everything displayed?
         runs(function () {
-            var sources = $('div.mkwsFacet[data-mkws-facet="xtargets"]');
+            var sources = $("div.mkwsFacet[data-mkws-facet='xtargets']");
             debug("Termlist sources success: " + sources.length);
             expect(sources.length).toBe(1);
 
-            var subjects = $('div.mkwsFacet[data-mkws-facet="subject"]');
+            var subjects = $("div.mkwsFacet[data-mkws-facet='subject']");
             expect(subjects.length).toBe(1);
 
-            var authors = $('div.mkwsFacet[data-mkws-facet="author"]');
+            var authors = $("div.mkwsFacet[data-mkws-facet='author']");
             expect(authors.length).toBe(1);
         });
 
         waitsFor(function () {
-            return $('div.mkwsFacet[data-mkws-facet="author"] div.term').length >= 2 ? true : false;
+            return $("div.mkwsFacet[data-mkws-facet='author'] div.term").length >= 2 ? true : false;
         }, "At least one author link displayed", 4 * jasmine_config.second);
 
         runs(function () {
-            expect($('div.mkwsFacet[data-mkws-facet="author"] div.term').length).toBeGreaterThan(1);
+            expect($("div.mkwsFacet[data-mkws-facet='author'] div.term").length).toBeGreaterThan(1);
         });
     });
 
@@ -239,7 +243,7 @@ describe("Check Termlist", function () {
         // do not click on author with numbers, e.g.: "Bower, James M. Beeman, David, 1938-"
         // do not click on author names without a comma, e.g.: "Joe Barbara"
         // because searching on such authors won't find anything.
-        var terms = $("div.mkwsFacetAuthors div.term a");
+        var terms = $("div.mkwsFacet[data-mkws-facet='author'] div.term a");
         for (var i = 0; i < terms.length; i++) {
             var term = $(terms[i]).text();
             if (term.match(/[0-9].+[0-9]/i) || !term.match(/,/)) {
@@ -249,13 +253,13 @@ describe("Check Termlist", function () {
                 break;
             }
         }
-        if ($("div.mkwsFacetAuthors div.term:nth-child(" + author_number + ") a").text().length == 0) {
+        if ($("div.mkwsFacet[data-mkws-facet='author'] div.term:nth-child(" + author_number + ") a").text().length == 0) {
             debug("No good authors found. Not clicking on the bad ones");
             return;
         }
 
-        debug("Clicking on author (" + author_number + ") " + $("div.mkwsFacetAuthors div.term:nth-child(" + author_number + ") a").text());
-        $("div.mkwsFacetAuthors div.term:nth-child(" + author_number + ") a").trigger("click");
+        debug("Clicking on author (" + author_number + ") " + $("div.mkwsFacet[data-mkws-facet='author'] div.term:nth-child(" + author_number + ") a").text());
+        $("div.mkwsFacet[data-mkws-facet='author'] div.term:nth-child(" + author_number + ") a").trigger("click");
 
         waitsFor(function () {
             return get_hit_counter() < hits_all_targets ? true : false;
@@ -268,11 +272,31 @@ describe("Check Termlist", function () {
         });
     });
 
+    it("check for active clients", function () {
+        waitsFor(function () {
+            var clients = $("div#mkwsStat span.clients");
+            //debug("clients: " + clients.text());
+            return clients.length == 1 && clients.text().match("/[1-9]+[0-9]+$");
+        }, "wait for Active clients: x/y", 5 * jasmine_config.second);
+
+        runs(function () {
+            var clients = $("div#mkwsStat span.clients");
+            debug("span.clients: " + clients.text());
+            expect(clients.text()).toMatch("/[1-9]+[0-9]+$");
+
+            // exact match of active clients (e.g. a SP misconfiguration)            
+            if (jasmine_config.active_clients) {
+                debug("check for " + jasmine_config.active_clients + " active connections");
+                expect(clients.text()).toMatch(" [0-9]+/" + jasmine_config.active_clients + "$");
+            }
+        });
+    });
+
     it("limit search to first source", function () {
         var hits_all_targets = get_hit_counter();
         var source_number = 2; // 2=first source
         // do not click on wikipedia link - no author or subject facets possible
-        var terms = $("div.mkwsFacetSources div.term a");
+        var terms = $("div.mkwsFacet[data-mkws-facet='xtargets'] div.term a");
         for (var i = 0; i < terms.length; i++) {
             var term = $(terms[i]).text();
             if (term.match(/wikipedia/i)) {
@@ -282,12 +306,12 @@ describe("Check Termlist", function () {
                 break;
             }
         }
-        if ($("div.mkwsFacetSources div.term:nth-child(" + source_number + ") a").text().length == 0) {
+        if ($("div.mkwsFacet[data-mkws-facet='xtargets'] div.term:nth-child(" + source_number + ") a").text().length == 0) {
             debug("No good source found. Not clicking on the bad ones");
             return;
         }
 
-        $("div.mkwsFacetSources div.term:nth-child(" + source_number + ") a").trigger("click");
+        $("div.mkwsFacet[data-mkws-facet='xtargets'] div.term:nth-child(" + source_number + ") a").trigger("click");
 
         // wait for a stat response
         var waitcount = 0;
@@ -314,6 +338,7 @@ describe("Check Termlist", function () {
             var hits_single_target = get_hit_counter();
             debug("get less hits for sources: " + hits_all_targets + " > " + hits_single_target);
             expect(hits_all_targets).not.toBeLessThan(hits_single_target);
+            jasmine_status.source_click = 1;
 
             $(".mkwsPager").unbind("DOMNodeInserted DOMNodeRemoved propertychange");
         });
@@ -323,10 +348,14 @@ describe("Check Termlist", function () {
 
 describe("Check record list", function () {
     it("check for single active client", function () {
+        if (!jasmine_status.source_click) {
+            debug("skip clients check due missing source click");
+            return;
+        }
+
         waitsFor(function () {
             var clients = $("div#mkwsStat span.clients");
             //debug("clients: " + clients.text());
-
             return clients.length == 1 && clients.text().match("/1$");
         }, "wait for Active clients: x/1", 5 * jasmine_config.second);
 
@@ -362,7 +391,6 @@ describe("Show record", function () {
         waitsFor(function () {
             var show = $("div.mkwsRecords div.record:nth-child(" + record_number + ") > div.details");
             //debug("poprecord: " + (show ? show.length : -1) + " " + $("div.mkwsRecords div.record").text());
-
             return show != null && show.length ? true : false;
         }, "wait some miliseconds to show up a record", 2 * jasmine_config.second);
 
@@ -436,6 +464,11 @@ describe("Check status client counter", function () {
     var time = get_time();
 
     it("check status clients", function () {
+        if (!jasmine_status.source_click) {
+            debug("skip clients check due missing source click");
+            return;
+        }
+
         waitsFor(function () {
             var clients = $("div#mkwsStat span.clients");
             debug("clients: " + clients.text());
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>
+
index 36c99b9..17a2141 100644 (file)
@@ -15,6 +15,9 @@
 
     DocumentRoot /home/indexdata/mkws-dev/examples/htdocs
     Alias /tools/htdocs /home/indexdata/mkws-dev/tools/htdocs
+    Alias /src /home/indexdata/mkws-dev/src
+    Alias /test /home/indexdata/mkws-dev/test
+    Alias /jasmine /home/indexdata/mkws-dev/examples/jasmine
 
     # CORS setting
     Header set Access-Control-Allow-Credentials true