Index: tests/integration/Makefile.am
===================================================================
--- tests/integration/Makefile.am	(revision 83fa5c5e12fc16a86272911a83b7d5c83fb505f7)
+++ tests/integration/Makefile.am	(revision 83fa5c5e12fc16a86272911a83b7d5c83fb505f7)
@@ -0,0 +1,69 @@
+AUTOM4TE = $(SHELL) $(top_srcdir)/build-aux/missing --run autom4te
+
+if CONDJOBMARKET
+TESTSUITE = $(srcdir)/testsuite
+endif
+
+DISTCLEANFILES = atconfig
+
+TESTSCRIPTS =
+
+if CONDJOBMARKET
+TESTSCRIPTS += \
+	$(srcdir)/testsuite-integration.at \
+	$(srcdir)/testsuite-integration-mpqc-jobs.at
+endif
+
+EXTRA_DIST = \
+	testsuite.at \
+	$(TESTSUITE) \
+	atlocal.in \
+	molecuilder.in \
+	mpqc.in \
+	package.m4 \
+	pre \
+	$(TESTSCRIPTS)
+
+if CONDJOBMARKET
+max_jobs = 4
+ 
+check-local: atconfig atlocal $(TESTSUITE) $(TESTSCRIPTS)
+	nrjobs=; \
+	for flag in $$MAKEFLAGS; do \
+		case $$flag in \
+		--* | =*=) ;; \
+		*j*) nrjobs="-j$(max_jobs)" ;; \
+		esac; \
+	done; \
+	$(SHELL) '$(TESTSUITE)' $$nrjobs AUTOTEST_PATH='$(abs_top_builddir)/src' $(TESTSUITEFLAGS)
+
+installcheck-local: atconfig atlocal $(TESTSUITE)
+	nrjobs=; \
+	for flag in $$MAKEFLAGS; do \
+		case $$flag in \
+		--* | =*=) ;; \
+		*j*) nrjobs="-j$(max_jobs)" ;; \
+		esac; \
+	done; \
+	$(SHELL) '$(TESTSUITE)' $$nrjobs AUTOTEST_PATH='$(bindir)' $(TESTSUITEFLAGS)
+
+clean-local:
+	test ! -f '$(TESTSUITE)' || \
+	$(SHELL) '$(TESTSUITE)' --clean
+
+AUTOTEST = $(AUTOM4TE) --language=autotest
+$(TESTSUITE): $(srcdir)/testsuite.at package.m4 $(TESTSCRIPTS)
+	$(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at
+	mv $@.tmp $@
+endif
+
+# The `:;' works around a Bash 3.2 bug when the output is not writeable.
+package.m4: $(top_srcdir)/configure.ac
+	:;{ \
+		echo '# Signature of the current package.' && \
+		echo 'm4_define([AT_PACKAGE_NAME],      [@PACKAGE_NAME@])' && \
+		echo 'm4_define([AT_PACKAGE_TARNAME],   [@PACKAGE_TARNAME@])' && \
+		echo 'm4_define([AT_PACKAGE_VERSION],   [@PACKAGE_VERSION@])' && \
+		echo 'm4_define([AT_PACKAGE_STRING],    [@PACKAGE_STRING@])' && \
+		echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
+	} >'package.m4'
Index: tests/integration/pre/ethane.pdb
===================================================================
--- tests/integration/pre/ethane.pdb	(revision 83fa5c5e12fc16a86272911a83b7d5c83fb505f7)
+++ tests/integration/pre/ethane.pdb	(revision 83fa5c5e12fc16a86272911a83b7d5c83fb505f7)
@@ -0,0 +1,18 @@
+REMARK created by molecuilder on Fri Mar  1 19:45:11 2013, time step 0
+ATOM      1 C01 0eth 01          3.125  10.442  10.000  0.00  0.00           C 0
+ATOM      2 C02 0eth 01          4.374   9.559  10.000  0.00  0.00           C 0
+ATOM      3 H01 0eth 01          3.125  11.071   9.110  0.00  0.00           H 0
+ATOM      4 H02 0eth 01          3.125  11.071  10.890  0.00  0.00           H 0
+ATOM      5 H03 0eth 01          4.374   8.929   9.110  0.00  0.00           H 0
+ATOM      6 H04 0eth 01          4.374   8.929  10.890  0.00  0.00           H 0
+ATOM      7 H05 0eth 01          2.235   9.813  10.000  0.00  0.00           H 0
+ATOM      8 H06 0eth 01          5.264  10.188  10.000  0.00  0.00           H 0
+CONECT    1    2    3    4    7                                                 
+CONECT    2    1    5    6    8                                                 
+CONECT    3    1                                                                
+CONECT    4    1                                                                
+CONECT    5    2                                                                
+CONECT    6    2                                                                
+CONECT    7    1                                                                
+CONECT    8    2                                                                
+END
Index: tests/integration/testsuite-integration-mpqc-jobs.at
===================================================================
--- tests/integration/testsuite-integration-mpqc-jobs.at	(revision 83fa5c5e12fc16a86272911a83b7d5c83fb505f7)
+++ tests/integration/testsuite-integration-mpqc-jobs.at	(revision 83fa5c5e12fc16a86272911a83b7d5c83fb505f7)
@@ -0,0 +1,80 @@
+#
+#    MoleCuilder - creates and alters molecular systems
+#    Copyright (C) 2008-2012 University of Bonn
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+### test mpqc jobs 
+
+# perform test with PoolWorkers using stastand-inn mpqc
+AT_SETUP([Integration - fragmentation plus automated fragment calculation via mpqc])
+AT_KEYWORDS([fragmentation automation server poolworker mpqc])
+
+# check that ports are unique over all tests such that they may run in parallel
+WORKERPORT=1060
+CONTROLLERPORT=1061
+WORKERLISTENPORT=1062
+
+# start service in background
+${AUTOTEST_PATH}/Server --workerport $WORKERPORT --controllerport $CONTROLLERPORT &
+server_pid=$!
+AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid])
+
+# enlist a worker to work on jobs
+../../mpqc +v 5 ++signal 2 ++server 127.0.0.1:${WORKERPORT} ++hostname 127.0.0.1 ++listen $WORKERLISTENPORT &
+worker_pid=$!
+AT_CHECK([sleep 5], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
+
+# create jobs via molecuilder
+molfile="ethane.pdb"
+AT_CHECK([cp -f ${abs_top_srcdir}/tests/integration/pre/ethane.pdb $molfile], 0)
+AT_CHECK([chmod +rw $molfile], 0)
+AT_CHECK([../../molecuilder \
+	-i $molfile \
+	--select-all-atoms \
+	--update-molecules \
+	--set-parser-parameters mpqc \
+		--parser-parameters "theory=CLHF;basis=3-21G;" \
+	--fragment-molecule BondFragment \
+		--order 2 \
+		--grid-level 5 \
+	--fragment-automation \
+		--server-address 127.0.0.1 \
+		--server-port ${CONTROLLERPORT} \
+		--DoLongrange 0 \
+	--verbose 3 \
+	--analyse-fragment-results results.dat], 0, [stdout], [ignore], [kill $server_pid $worker_pid])
+
+# send removeall to server such that all workers shutdown
+AT_CHECK([${AUTOTEST_PATH}/Controller --server 127.0.0.1:$CONTROLLERPORT --command removeall], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
+
+# check number of done jobs
+NoJobs=`ls -l ${abs_top_srcdir}/tests/JobMarket/pre/BondFragment* 2>/dev/null | wc -l` 
+AT_CHECK([fgrep "There are 3 fragments" stdout], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
+AT_CHECK([fgrep "There are 1 molecules to consider" stdout], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
+AT_CHECK([fgrep "8 atoms selected." stdout], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
+AT_CHECK([tail -n 1 BondFragment_Energy.dat | awk '{if ($2!=-78.79298686) exit 1}'], 0, [ignore], [ignore], [kill $server_pid $worker_pid])
+
+# shutdown controller socket 
+AT_CHECK([${AUTOTEST_PATH}/Controller --server 127.0.0.1:$CONTROLLERPORT --command shutdown], 0, [stdout], [ignore], [kill $server_pid $worker_pid])
+
+# check that worker is truely down
+AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $worker_pid $server_pid])
+AT_CHECK([kill $worker_pid], 1, [ignore], [ignore], [kill $server_pid])
+
+# check that server is truely down
+AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid])
+AT_CHECK([kill $server_pid], 1, [ignore], [ignore])
+
+AT_CLEANUP
Index: tests/integration/testsuite-integration.at
===================================================================
--- tests/integration/testsuite-integration.at	(revision 83fa5c5e12fc16a86272911a83b7d5c83fb505f7)
+++ tests/integration/testsuite-integration.at	(revision 83fa5c5e12fc16a86272911a83b7d5c83fb505f7)
@@ -0,0 +1,21 @@
+#
+#    MoleCuilder - creates and alters molecular systems
+#    Copyright (C) 2008-2012 University of Bonn
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+AT_BANNER([MoleCuilder - integration test])
+
+# check whether mpqc jobs work with controller and server
+m4_include([testsuite-integration-mpqc-jobs.at])
Index: tests/integration/testsuite.at
===================================================================
--- tests/integration/testsuite.at	(revision 83fa5c5e12fc16a86272911a83b7d5c83fb505f7)
+++ tests/integration/testsuite.at	(revision 83fa5c5e12fc16a86272911a83b7d5c83fb505f7)
@@ -0,0 +1,30 @@
+#
+#    MoleCuilder - creates and alters molecular systems
+#    Copyright (C) 2008-2012 University of Bonn
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+# Process with autom4te to create an -*- Autotest -*- test suite.
+#
+# see regression/... subdirs wherein for each of the cases and each check (enumerated) is a pre and post dir. 
+# In pre initial files are placed, in post results can be found to be checked by diff in this testsuite.
+
+AT_INIT([Molecuilder integration module])
+AT_TESTED(diff grep egrep fgrep)
+
+# Use colored output with new-enough Autotest.
+m4_ifdef([AT_COLOR_TESTS], [AT_COLOR_TESTS])
+
+# JobMarket
+m4_include([testsuite-integration.at])
