...
 
Commits (233)
CEP/Calibration/BBSControl/Makefile.common
CEP/Calibration/BBSControl/autoconf_share
CEP/Calibration/BBSControl/lofarconf
CEP/Calibration/BBSKernel/Makefile.common
CEP/Calibration/BBSKernel/autoconf_share
CEP/Calibration/BBSKernel/lofarconf
CEP/DP3/DPPP/Makefile.common
CEP/DP3/DPPP/autoconf_share
CEP/DP3/DPPP/lofarconf
CEP/DP3/SPWCombine/Makefile.common
CEP/DP3/SPWCombine/autoconf_share
CEP/DP3/SPWCombine/lofarconf
CEP/LMWCommon/Makefile.common
CEP/LMWCommon/autoconf_share
CEP/LMWCommon/lofarconf
CEP/MS/Makefile.common
CEP/MS/autoconf_share
CEP/MS/lofarconf
CEP/ParmDB/Makefile.common
CEP/ParmDB/autoconf_share
CEP/ParmDB/lofarconf
CEP/pyparmdb/Makefile.common
CEP/pyparmdb/autoconf_share
CEP/pyparmdb/lofarconf
CEP/pyparmdb/py-compile
JAVA/GUI/Plotter/PlotterConfig/build
JAVA/GUI/Plotter/PlotterConfig/dist
JAVA/GUI/Plotter/PlotterConfig/nbproject/private
JAVA/GUI/Plotter/build
JAVA/GUI/Plotter/dist
JAVA/GUI/Plotter/nbproject
JAVA/GUI/Plotter/target
JAVA/GUI/build
JAVA/GUI/dist
JAVA/LofarUtils/build
JAVA/LofarUtils/dist
JAVA/LofarUtils/nbproject
JAVA/LofarUtils/target
LCS/ACC/ALC/Makefile.common
LCS/ACC/ALC/autoconf_share
LCS/ACC/ALC/lofarconf
LCS/ACC/PLC/Makefile.common
LCS/ACC/PLC/autoconf_share
LCS/ACC/PLC/lofarconf
LCS/AMC/AMCBase/Makefile.common
LCS/AMC/AMCBase/autoconf_share
LCS/AMC/AMCBase/lofarconf
LCS/AMC/AMCImpl/Makefile.common
LCS/AMC/AMCImpl/autoconf_share
LCS/AMC/AMCImpl/lofarconf
LCS/AMC/Makefile.common
LCS/AMC/autoconf_share
LCS/AMC/lofarconf
LCS/ApplCommon/Makefile.common
LCS/ApplCommon/autoconf_share
LCS/ApplCommon/lofarconf
LCS/Blob/Makefile.common
LCS/Blob/autoconf_share
LCS/Blob/lofarconf
**/Makefile.common
**/autoconf_share
**/lofarconf
**/py-compile
**/build
**/dist
**/nbproject
**/target
LCS/Blob/ylwrap
LCS/Common/Makefile.common
LCS/Common/autoconf_share
LCS/Common/lofarconf
LCS/Stream/Makefile.common
LCS/Stream/autoconf_share
LCS/Stream/lofarconf
LCS/Tools/Makefile.common
LCS/Tools/autoconf_share
LCS/Tools/lofarconf
LCS/Transport/Makefile.common
LCS/Transport/autoconf_share
LCS/Transport/lofarconf
LCS/pytools/Makefile.common
LCS/pytools/autoconf_share
LCS/pytools/lofarconf
LCS/pytools/py-compile
LCU/Firmware/tools/Makefile.common
LCU/Firmware/tools/autoconf_share
LCU/Firmware/tools/lofarconf
MAC/APL/APLCommon/Makefile.common
MAC/APL/APLCommon/autoconf_share
MAC/APL/APLCommon/lofarconf
MAC/APL/CEPCU/Makefile.common
MAC/APL/CEPCU/autoconf_share
MAC/APL/CEPCU/lofarconf
MAC/APL/CUDaemons/Makefile.common
MAC/APL/CUDaemons/autoconf_share
MAC/APL/CUDaemons/lofarconf
MAC/APL/CURTDBDaemons/Makefile.common
MAC/APL/CURTDBDaemons/autoconf_share
MAC/APL/CURTDBDaemons/lofarconf
MAC/APL/MainCU/Makefile.common
MAC/APL/MainCU/autoconf_share
MAC/APL/MainCU/lofarconf
MAC/APL/PAC/CAL_Protocol/Makefile.common
MAC/APL/PAC/CAL_Protocol/autoconf_share
MAC/APL/PAC/CAL_Protocol/lofarconf
MAC/APL/PAC/Cal_Server/Makefile.common
MAC/APL/PAC/Cal_Server/autoconf_share
MAC/APL/PAC/Cal_Server/lofarconf
MAC/APL/PAC/LBA_Calibration/Makefile.common
MAC/APL/PAC/LBA_Calibration/autoconf_share
MAC/APL/PAC/LBA_Calibration/lofarconf
MAC/APL/PAC/Makefile.common
MAC/APL/PAC/SHMInfo_Server/Makefile.common
MAC/APL/PAC/SHMInfo_Server/autoconf_share
MAC/APL/PAC/SHMInfo_Server/lofarconf
MAC/APL/PAC/autoconf_share
MAC/APL/PAC/lofarconf
MAC/APL/PIC/ETHTest/Makefile.common
MAC/APL/PIC/ETHTest/autoconf_share
MAC/APL/PIC/ETHTest/lofarconf
MAC/APL/PIC/Makefile.common
MAC/APL/PIC/RSP_Driver/Makefile.common
MAC/APL/PIC/RSP_Driver/autoconf_share
MAC/APL/PIC/RSP_Driver/lofarconf
MAC/APL/PIC/RSP_Protocol/Makefile.common
MAC/APL/PIC/RSP_Protocol/autoconf_share
MAC/APL/PIC/RSP_Protocol/lofarconf
MAC/APL/PIC/TBB_Driver/Makefile.common
MAC/APL/PIC/TBB_Driver/autoconf_share
MAC/APL/PIC/TBB_Driver/lofarconf
MAC/APL/PIC/TBB_Protocol/Makefile.common
MAC/APL/PIC/TBB_Protocol/autoconf_share
MAC/APL/PIC/TBB_Protocol/lofarconf
MAC/APL/PIC/autoconf_share
MAC/APL/PIC/lofarconf
MAC/APL/PIC/rsuctl/Makefile.common
MAC/APL/PIC/rsuctl/autoconf_share
MAC/APL/PIC/rsuctl/lofarconf
MAC/APL/RTCCommon/Makefile.common
MAC/APL/RTCCommon/autoconf_share
MAC/APL/RTCCommon/lofarconf
MAC/APL/RTDBCommon/Makefile.common
MAC/APL/RTDBCommon/autoconf_share
MAC/APL/RTDBCommon/lofarconf
MAC/APL/StationCU/Makefile.common
MAC/APL/StationCU/autoconf_share
MAC/APL/StationCU/lofarconf
MAC/APL/StsMisc/Makefile.common
MAC/APL/StsMisc/autoconf_share
MAC/APL/StsMisc/lofarconf
MAC/APL/TestCtlr/Makefile.common
MAC/APL/TestCtlr/autoconf_share
MAC/APL/TestCtlr/lofarconf
MAC/APL/TestSuite/Makefile.common
MAC/APL/TestSuite/autoconf_share
MAC/APL/TestSuite/lofarconf
MAC/Deployment/Makefile.common
MAC/Deployment/autoconf_share
MAC/Deployment/lofarconf
MAC/Drivers/spid/Makefile.common
MAC/Drivers/spid/autoconf_share
MAC/Drivers/spid/lofarconf
MAC/GCF/LogSys/Makefile.common
MAC/GCF/LogSys/autoconf_share
MAC/GCF/LogSys/lofarconf
MAC/GCF/PVSS/Makefile.common
MAC/GCF/PVSS/autoconf_share
MAC/GCF/PVSS/lofarconf
MAC/GCF/RTDB/Makefile.common
MAC/GCF/RTDB/autoconf_share
MAC/GCF/RTDB/lofarconf
MAC/GCF/TM/Makefile.common
MAC/GCF/TM/autoconf_share
MAC/GCF/TM/lofarconf
MAC/GCF/_PAL/Makefile.common
MAC/GCF/_PAL/autoconf_share
MAC/GCF/_PAL/lofarconf
MAC/GCF/_PALlight/Makefile.common
MAC/GCF/_PALlight/autoconf_share
MAC/GCF/_PALlight/lofarconf
MAC/MACIO/Makefile.common
MAC/MACIO/autoconf_share
MAC/MACIO/lofarconf
MAC/Navigator2/Makefile.common
MAC/Navigator2/autoconf_share
MAC/Navigator2/lofarconf
MAC/Test/GCF/CEP/Makefile.common
MAC/Test/GCF/CEP/autoconf_share
MAC/Test/GCF/CEP/lofarconf
MAC/Test/GCF/MAC/Makefile.common
MAC/Test/GCF/MAC/autoconf_share
MAC/Test/GCF/MAC/lofarconf
MAC/Test/GCF/RTC/Makefile.common
MAC/Test/GCF/RTC/autoconf_share
MAC/Test/GCF/RTC/lofarconf
MAC/Test/PROTO/GPI/Makefile.common
MAC/Test/PROTO/GPI/autoconf_share
MAC/Test/PROTO/GPI/lofarconf
MAC/Test/PROTO/PI/Makefile.common
MAC/Test/PROTO/PI/autoconf_share
MAC/Test/PROTO/PI/lofarconf
MAC/Test/PROTO/PROP/Makefile.common
MAC/Test/PROTO/PROP/autoconf_share
MAC/Test/PROTO/PROP/lofarconf
MAC/Test/PROTO/PVSSAPI/Makefile.common
MAC/Test/PROTO/PVSSAPI/autoconf_share
MAC/Test/PROTO/PVSSAPI/lofarconf
MAC/Test/PROTO/TASK/Makefile.common
MAC/Test/PROTO/TASK/autoconf_share
MAC/Test/PROTO/TASK/lofarconf
MAC/Test/TestHarness/THEcho/Makefile.common
MAC/Test/TestHarness/THEcho/autoconf_share
MAC/Test/TestHarness/THEcho/lofarconf
MAC/Test/TestHarness/THPVSSBridge/Makefile.common
MAC/Test/TestHarness/THPVSSBridge/autoconf_share
MAC/Test/TestHarness/THPVSSBridge/lofarconf
MAC/Test/TestHarness/TSE/Makefile.common
MAC/Test/TestHarness/TSE/autoconf_share
MAC/Test/TestHarness/TSE/lofarconf
MAC/Tools/Makefile.common
MAC/Tools/autoconf_share
MAC/Tools/lofarconf
RTCP/Cobalt/CoInterface/Makefile.common
RTCP/Cobalt/CoInterface/autoconf_share
RTCP/Cobalt/CoInterface/lofarconf
RTCP/Cobalt/OutputProc/Makefile.common
RTCP/Cobalt/OutputProc/autoconf_share
RTCP/Cobalt/OutputProc/lofarconf
SAS/OTB/OTB-distribution/*.classpath
SAS/OTB/OTB-distribution/*.project
SAS/OTB/OTB-distribution/*.settings
SAS/OTB/OTB-distribution/target
SAS/OTB/OTB/build
SAS/OTB/OTB/dist
SAS/OTB/OTB/nbproject
SAS/OTB/OTB/target
SAS/OTB/RSP/build
SAS/OTB/RSP/dist
SAS/OTB/RSP/nbproject
**/*.classpath
**/*.project
**/*.settings
SAS/OTB/RSP/src/nl/astron/lofar/java/sas/otb/rsp/subbandstats/WaveformSettingsListPanel.form
SAS/OTB/RSP/src/nl/astron/lofar/java/sas/otb/rsp/subbandstats/WaveformSettingsListPanel.java
SAS/OTB/RSP/target
SAS/OTB/jOTDB3/build
SAS/OTB/jOTDB3/dist
SAS/OTB/jOTDB3/target
SAS/OTB/jParmFacade/Makefile.common
SAS/OTB/jParmFacade/autoconf_share
SAS/OTB/jParmFacade/build
SAS/OTB/jParmFacade/dist
SAS/OTB/jParmFacade/lofarconf
SAS/OTB/jParmFacade/nbproject
SAS/OTB/jParmFacade/target
SAS/OTB/jRSP/Makefile.am
SAS/OTB/jRSP/autoconf_share
SAS/OTB/jRSP/bootstrap
SAS/OTB/jRSP/configure.in
SAS/OTB/jRSP/nbproject
SAS/OTB/jRSP/target
SAS/OTB/nbproject
SAS/OTDB/Makefile.common
SAS/OTDB/autoconf_share
SAS/OTDB/lofarconf
......@@ -4,14 +4,13 @@
#include <armadillo>
#include <DPPP_DDECal/PiercePoint.h>
using namespace arma;
namespace LOFAR{
class KLFitter
{//creates KH base and fits screens from collection of PiercePoints
public:
KLFitter(double r0=1000.,double beta=5./3.,int order=3);
void calculateCorrMatrix(const vector<PiercePoint> pp);
void calculateCorrMatrix(const vector<PiercePoint*> pp);
void calculateCorrMatrix(const std::vector<PiercePoint> pp);
void calculateCorrMatrix(const std::vector<PiercePoint*> pp);
void doFit();
size_t getOrder() const {return itsOrder;}
double* PhaseData() { return _phases.memptr(); }
......@@ -27,15 +26,15 @@ public:
private:
size_t itsOrder;
double itsR0,itsBeta;
Mat<double> itsPiercePoints;
Col<double> _phases;
Mat<double> _weights; //weights of the data points
Mat<double> itsCorrMatrix; //Correlation Matrix for KL fit
Mat<double> itsinvC; //for quick interpolation
Mat<double> itsU;
Mat<double> itsinvU;
Mat<double> itsTECFitWhite;
Col<double> itsPar;
arma::Mat<double> itsPiercePoints;
arma::Col<double> _phases;
arma::Mat<double> _weights; //weights of the data points
arma::Mat<double> itsCorrMatrix; //Correlation Matrix for KL fit
arma::Mat<double> itsinvC; //for quick interpolation
arma::Mat<double> itsU;
arma::Mat<double> itsinvU;
arma::Mat<double> itsTECFitWhite;
arma::Col<double> itsPar;
};
}
#endif
......@@ -11,7 +11,6 @@
#include <armadillo>
using namespace arma;
namespace LOFAR{
class PiercePoint
......@@ -24,7 +23,7 @@ public:
PiercePoint(const casacore::MPosition &ant,const casacore::MDirection &source);
void init(const casacore::MPosition &ant,const casacore::MDirection &source,const double height);
void evaluate(casacore::MEpoch time);
Col<double> getValue() const {return itsValue;}
arma::Col<double> getValue() const {return itsValue;}
casacore::MPosition getPos() const {return itsPosition;}
casacore::MDirection getDir() const {return itsDirection;}
private:
......@@ -36,7 +35,7 @@ private:
double itsIonoHeight;
// square of length antenna vector (int ITRF) minus square of vector to piercepoint. This is constant for a assumed spherical Earth
double itsC;
Col<double> itsValue; //PiercePoint in ITRF coordinates
arma::Col<double> itsValue; //PiercePoint in ITRF coordinates
};
}
#endif
......@@ -30,7 +30,6 @@
#define SCREEN_FITTER_H
#include <armadillo>
#include <vector>
using namespace arma;
class ScreenFitter{
public:
......
......@@ -11,7 +11,7 @@ KLFitter::KLFitter(double r0,double beta,int order):
void KLFitter::calculateCorrMatrix(const vector<PiercePoint> pp){
void KLFitter::calculateCorrMatrix(const std::vector<PiercePoint> pp){
itsPiercePoints.set_size(pp.size(),3);
_phases.set_size(pp.size());
_weights=eye<mat>(pp.size(),pp.size()); //TODO, make weights sensible
......@@ -33,7 +33,7 @@ void KLFitter::calculateCorrMatrix(const vector<PiercePoint> pp){
itsinvU=inv(itsU.t()*(_weights*itsU));
}
void KLFitter::calculateCorrMatrix(const vector<PiercePoint*> pp){
void KLFitter::calculateCorrMatrix(const std::vector<PiercePoint*> pp){
itsPiercePoints.set_size(pp.size(),3);
_phases.set_size(pp.size());
_weights=eye<mat>(pp.size(),pp.size()); //TODO, make weights sensible
......
......@@ -36,8 +36,6 @@
namespace LOFAR {
namespace LofarFT {
using namespace CFDefs;
class CFStore
{
......@@ -45,7 +43,7 @@ public:
CFStore();
CFStore(const casacore::CountedPtr<CFType>& dataPtr,
CFStore(const casacore::CountedPtr<CFDefs::CFType>& dataPtr,
casacore::CoordinateSystem& cs,
casacore::Vector<casacore::Float>& samp,
casacore::Vector<casacore::Int>& xsup,
......@@ -56,7 +54,7 @@ public:
casacore::Int mosPointing,
casacore::Bool conjugated = casacore::False);
CFStore(const casacore::CountedPtr<CFTypeVec>& dataPtr,
CFStore(const casacore::CountedPtr<CFDefs::CFTypeVec>& dataPtr,
casacore::CoordinateSystem& cs,
casacore::Vector<casacore::Float>& samp,
casacore::Vector<casacore::Int>& xsup,
......@@ -79,7 +77,7 @@ public:
void set(const CFStore& other);
void set(CFType *dataPtr,
void set(CFDefs::CFType *dataPtr,
casacore::CoordinateSystem& cs,
casacore::Vector<casacore::Float>& samp,
casacore::Vector<casacore::Int>& xsup,
......@@ -90,7 +88,7 @@ public:
const casacore::Int mosPointing=0,
casacore::Bool conjugated = casacore::False);
void set(CFTypeVec *dataPtr,
void set(CFDefs::CFTypeVec *dataPtr,
casacore::CoordinateSystem& cs,
casacore::Vector<casacore::Float>& samp,
casacore::Vector<casacore::Int>& xsup,
......@@ -107,15 +105,15 @@ public:
void resize(casacore::IPosition imShape,
casacore::Bool retainValues=casacore::False);
CFTypeVec& vdata() {return *itsVData;}
CFDefs::CFTypeVec& vdata() {return *itsVData;}
casacore::Vector<casacore::Float>& sampling() {return itsSampling;}
casacore::Vector<casacore::Int>& xSupport() {return itsXSupport;}
casacore::Vector<casacore::Int>& ySupport() {return itsYSupport;}
casacore::CountedPtr<CFType> itsData;
casacore::CountedPtr<CFTypeReal> itsRData;
casacore::CountedPtr<CFTypeVec> itsVData;
casacore::CountedPtr<CFDefs::CFType> itsData;
casacore::CountedPtr<CFDefs::CFTypeReal> itsRData;
casacore::CountedPtr<CFDefs::CFTypeVec> itsVData;
casacore::CoordinateSystem itsCoordSys;
casacore::Vector<casacore::Float> itsSampling;
casacore::Vector<casacore::Int> itsXSupport;
......
......@@ -453,8 +453,8 @@ CFStore ConvolutionFunction::makeConvolutionFunction(
timerPar.start();
CountedPtr<CFTypeVec> res (new CFTypeVec());
CFTypeVec& result = *res;
CountedPtr<CFDefs::CFTypeVec> res (new CFDefs::CFTypeVec());
CFDefs::CFTypeVec& result = *res;
// Compute the the beam, will be taken from cache if available
map<Double, vector< vector< Cube<Complex> > > >::const_iterator aiter = itsAtermStore.find(time);
......
......@@ -218,8 +218,8 @@ CFStore ConvolutionFunctionDiagonal::makeConvolutionFunction(
timerPar.start();
CountedPtr<CFTypeVec> res (new CFTypeVec());
CFTypeVec& result = *res;
CountedPtr<CFDefs::CFTypeVec> res (new CFDefs::CFTypeVec());
CFDefs::CFTypeVec& result = *res;
// Compute the the beam, will be taken from cache if available
map<Double, vector< vector< Cube<Complex> > > >::const_iterator aiter = itsAtermStore.find(time);
......
......@@ -53,12 +53,6 @@
#endif
using namespace casacore;
namespace LOFAR
{
......
......@@ -45,8 +45,6 @@
#include <casacore/casa/OS/PrecTimer.h>
using namespace casacore;
namespace LOFAR
{
......
......@@ -60,8 +60,6 @@
#include <Common/OpenMP.h>
using namespace casacore;
namespace LOFAR {
// <summary> An FTMachine for Gridded Fourier transforms </summary>
......
......@@ -49,8 +49,6 @@
#include <casacore/lattices/Lattices/ArrayLattice.h>
using namespace casacore;
namespace LOFAR {
// <summary> An FTMachine for Gridded Fourier transforms </summary>
......
......@@ -88,7 +88,6 @@
//=========
using namespace casacore;
namespace LOFAR { //# NAMESPACE CASACORE - BEGIN
......
......@@ -86,7 +86,6 @@
//=========
using namespace casacore;
namespace LOFAR { //# NAMESPACE CASACORE - BEGIN
......
# - Create for each LOFAR package a variable containing the absolute path to
# its source directory.
#
# Generated by gen_LofarPackageList_cmake.sh at ma 22 jul 2019 15:53:29 CEST
# Generated by bash at Mo 5. Aug 15:45:33 CEST 2019
#
# ---- DO NOT EDIT ----
#
......@@ -167,6 +167,7 @@ if(NOT DEFINED LOFAR_PACKAGE_LIST_INCLUDED)
set(TriggerEmailService_SOURCE_DIR ${CMAKE_SOURCE_DIR}/SAS/TriggerEmailService)
set(SpecificationServices_SOURCE_DIR ${CMAKE_SOURCE_DIR}/SAS/SpecificationServices)
set(XSD_SOURCE_DIR ${CMAKE_SOURCE_DIR}/SAS/XSD)
set(TBBAlertVOeventPublisher_SOURCE_DIR ${CMAKE_SOURCE_DIR}/SAS/TBBAlertVOeventPublisher)
set(DataManagementCommon_SOURCE_DIR ${CMAKE_SOURCE_DIR}/SAS/DataManagement/DataManagementCommon)
set(StorageQueryService_SOURCE_DIR ${CMAKE_SOURCE_DIR}/SAS/DataManagement/StorageQueryService)
set(Cleanup_SOURCE_DIR ${CMAKE_SOURCE_DIR}/SAS/DataManagement/Cleanup)
......
......@@ -44,6 +44,7 @@ set(_rvers "Unknown")
set(_grev "Unknown")
set(_lrev "Unknown")
set(_nrch "Unknown")
set(_output "")
if("@PACKAGE_VERSION@" MATCHES ".+")
set(_cvers @PACKAGE_VERSION@)
endif("@PACKAGE_VERSION@" MATCHES ".+")
......@@ -106,6 +107,41 @@ if(_result EQUAL 0)
file(REMOVE "${_svn_tmp}")
endif(_result EQUAL 0)
# Let Git find the needed information
find_package (Git)
if(GIT_FOUND)
# Get branch
execute_process(COMMAND ${GIT_EXECUTABLE} branch COMMAND grep ^\\* COMMAND cut -d " " -f2
RESULT_VARIABLE _result
OUTPUT_VARIABLE "_output"
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_VARIABLE _error)
if(_result EQUAL 0)
set(_branch ${_output})
endif(_result EQUAL 0)
# Set _rvers if we are on a tag
execute_process(COMMAND ${GIT_EXECUTABLE} describe --exact-match
RESULT_VARIABLE _result
OUTPUT_VARIABLE "_output"
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_VARIABLE _error)
if(_result EQUAL 0)
set(_rvers ${_output})
endif(_result EQUAL 0)
# Set _grev to git commit hash
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
RESULT_VARIABLE _result
OUTPUT_VARIABLE "_output"
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_VARIABLE _error)
if(_result EQUAL 0)
set(_grev ${_output})
endif(_result EQUAL 0)
endif(GIT_FOUND)
# Create/update Package__Version.h. Avoid unnecessary recompilations:
# first create a temporary file; only copy it if files are different.
set(_file "@CMAKE_BINARY_DIR@/include/Package__Version/@PACKAGE_NAME@/Package__Version.h")
......
......@@ -91,7 +91,7 @@ RUN export BUILD_PACKAGES="wget git cmake g++ gfortran flex bison libreadline-de
aptitude install -y ${BUILD_PACKAGES} && \
mkdir -p ${INSTALLDIR}/casacore/build && \
mkdir -p ${INSTALLDIR}/casacore/data && \
cd ${INSTALLDIR}/casacore && git clone --branch ${CASACORE_VERSION//latest/master} https://github.com/casacore/casacore.git src && \
cd ${INSTALLDIR}/casacore && git clone --depth 1 --shallow-submodules --branch ${CASACORE_VERSION//latest/master} https://github.com/casacore/casacore.git src && \
cd ${INSTALLDIR}/casacore/data && wget --retry-connrefused ftp://ftp.astron.nl/outgoing/Measures/WSRT_Measures.ztar && \
cd ${INSTALLDIR}/casacore/data && tar xf WSRT_Measures.ztar && rm -f WSRT_Measures.ztar && \
cd ${INSTALLDIR}/casacore/build && cmake -DCMAKE_INSTALL_PREFIX=${INSTALLDIR}/casacore/ -DDATA_DIR=${INSTALLDIR}/casacore/data -DBUILD_PYTHON3=ON -DBUILD_PYTHON=OFF -DPYTHON_EXECUTABLE=/usr/bin/python3 -DENABLE_TABLELOCKING=OFF -DUSE_OPENMP=ON -DUSE_FFTW3=TRUE -DUSE_HDF5=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="${CXX_FLAGS} -fsigned-char -DNDEBUG" ../src/ && \
......@@ -119,7 +119,7 @@ RUN aptitude install -y libboost-system${BOOST_VERSION}.1 libboost-thread${BOOST
RUN export BUILD_PACKAGES="git cmake g++ gfortran libboost-system${BOOST_VERSION}-dev libboost-thread${BOOST_VERSION}-dev libcfitsio-dev wcslib-dev libopenblas-dev" && \
aptitude install -y ${BUILD_PACKAGES} && \
mkdir -p ${INSTALLDIR}/casarest/build && \
cd ${INSTALLDIR}/casarest && git clone --branch ${CASAREST_VERSION//latest/master} https://github.com/casacore/casarest.git src && \
cd ${INSTALLDIR}/casarest && git clone --depth 1 --shallow-submodules --branch ${CASAREST_VERSION//latest/master} https://github.com/casacore/casarest.git src && \
cd ${INSTALLDIR}/casarest/build && cmake -DCMAKE_INSTALL_PREFIX=${INSTALLDIR}/casarest -DCASACORE_ROOT_DIR=${INSTALLDIR}/casacore -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="${CXX_FLAGS} -DNDEBUG" ../src/ && \
cd ${INSTALLDIR}/casarest/build && make -j ${J} && \
cd ${INSTALLDIR}/casarest/build && make install && \
......@@ -137,7 +137,7 @@ RUN export BUILD_PACKAGES="git cmake g++ gfortran libboost-system${BOOST_VERSION
RUN export BUILD_PACKAGES="git make g++ python3-setuptools libboost-python${BOOST_VERSION}-dev libcfitsio-dev wcslib-dev" && \
aptitude install -y ${BUILD_PACKAGES} && \
mkdir ${INSTALLDIR}/python-casacore && \
cd ${INSTALLDIR}/python-casacore && git clone --branch ${PYTHON_CASACORE_VERSION//latest/master} https://github.com/casacore/python-casacore.git && \
cd ${INSTALLDIR}/python-casacore && git clone --depth 1 --shallow-submodules --branch ${PYTHON_CASACORE_VERSION//latest/master} https://github.com/casacore/python-casacore.git && \
cd ${INSTALLDIR}/python-casacore/python-casacore && python3 ./setup.py build_ext -I${INSTALLDIR}/casacore/include/ -L${INSTALLDIR}/casacore/lib/ && \
mkdir -p ${INSTALLDIR}/python-casacore/lib/python${PYTHON_VERSION}/site-packages/ && \
mkdir -p ${INSTALLDIR}/python-casacore/lib64/python${PYTHON_VERSION}/site-packages/ && \
......@@ -165,7 +165,7 @@ RUN aptitude install -y sasl2-bin libuuid1 libnss3 libnspr4 xqilla libssl1.1 lib
RUN export BUILD_PACKAGES="git rsync swig ruby ruby-dev python-dev python-setuptools libsasl2-dev pkg-config cmake libtool uuid-dev libxerces-c-dev libnss3-dev libnspr4-dev help2man fakeroot build-essential g++ debhelper libssl-dev libxqilla-dev libboost-program-options${BOOST_VERSION}-dev libboost-filesystem${BOOST_VERSION}-dev" && \
aptitude install -y ${BUILD_PACKAGES} && \
mkdir ${INSTALLDIR}/qpid && \
git clone --branch ${LOFAR_VERSION//latest/master} https://git.astron.nl/ro/lofar.git /tmp/LOFAR && \
git clone --depth 1 --shallow-submodules --branch ${LOFAR_VERSION//latest/master} https://git.astron.nl/ro/lofar.git /tmp/LOFAR && \
rsync --archive /tmp/LOFAR/LCS/MessageBus/qpid/ ${INSTALLDIR}/qpid/ && \
rm -rf /tmp/LOFAR && \
bash -c "HOME=/tmp ${INSTALLDIR}/qpid/local/sbin/build_qpid" && \
......
......@@ -76,7 +76,7 @@ RUN aptitude install -y libboost-python${BOOST_VERSION}.1 libboost-numpy${BOOST_
RUN export BUILD_PACKAGES="git g++ gfortran libboost-python${BOOST_VERSION}-dev libboost-numpy${BOOST_VERSION}-dev python3-setuptools python3-numpy-dev swig3.0" && \
aptitude install -y ${BUILD_PACKAGES} && \
mkdir ${INSTALLDIR}/pybdsf && \
git clone --branch ${PYBDSF_VERSION//latest/master} https://github.com/lofar-astron/pybdsf.git ${INSTALLDIR}/pybdsf/pybdsf-${PYBDSF_VERSION} && \
git clone --depth 1 --shallow-submodules --branch ${PYBDSF_VERSION//latest/master} https://github.com/lofar-astron/pybdsf.git ${INSTALLDIR}/pybdsf/pybdsf-${PYBDSF_VERSION} && \
cd ${INSTALLDIR}/pybdsf/pybdsf-${PYBDSF_VERSION} && \
mkdir -p ${INSTALLDIR}/pybdsf/lib/python${PYTHON_VERSION}/site-packages/ && \
export PYTHONPATH=${INSTALLDIR}/pybdsf/lib/python${PYTHON_VERSION}/site-packages:${INSTALLDIR}/pybdsf/lib64/python${PYTHON_VERSION}/site-packages:${PYTHONPATH} && \
......@@ -103,7 +103,7 @@ RUN aptitude install -y libxml++${LIBXMLPP_VERSION}-2v5 libpng-tools libfftw3-bi
RUN export BUILD_PACKAGES="doxygen git cmake g++ libxml++${LIBXMLPP_VERSION}-dev libpng-dev libfftw3-dev libboost-python${BOOST_VERSION}-dev libboost-filesystem${BOOST_VERSION}-dev libboost-date-time${BOOST_VERSION}-dev libboost-signals${BOOST_VERSION}-dev libboost-thread${BOOST_VERSION}-dev libcfitsio-dev libopenblas-dev" && \
aptitude install -y ${BUILD_PACKAGES} && \
mkdir -p ${INSTALLDIR}/aoflagger && \
git clone https://git.code.sf.net/p/aoflagger/code ${INSTALLDIR}/aoflagger/aoflagger-${AOFLAGGER_VERSION} && \
git clone --depth 1 --shallow-submodules https://git.code.sf.net/p/aoflagger/code ${INSTALLDIR}/aoflagger/aoflagger-${AOFLAGGER_VERSION} && \
cd ${INSTALLDIR}/aoflagger/aoflagger-${AOFLAGGER_VERSION} && git checkout ${AOFLAGGER_VERSION//latest/master} && \
mkdir ${INSTALLDIR}/aoflagger/build && \
cd ${INSTALLDIR}/aoflagger/build && \
......@@ -131,7 +131,7 @@ RUN aptitude install -y libgsl${LIBGSL_VERSION} libhdf5-${LIBHDF5_VERSION} && \
RUN export BUILD_PACKAGES="git cmake g++ python3-setuptools doxygen libgsl0-dev libopenblas-dev libboost-date-time${BOOST_VERSION}-dev libhdf5-dev" && \
aptitude install -y ${BUILD_PACKAGES} && \
mkdir ${INSTALLDIR}/dysco && \
git clone --branch ${DYSCO_VERSION//latest/master} https://github.com/aroffringa/dysco.git ${INSTALLDIR}/dysco/dysco-${DYSCO_VERSION} && \
git clone --depth 1 --shallow-submodules --branch ${DYSCO_VERSION//latest/master} https://github.com/aroffringa/dysco.git ${INSTALLDIR}/dysco/dysco-${DYSCO_VERSION} && \
cd ${INSTALLDIR}/dysco && \
mkdir build && \
cd build && \
......@@ -162,7 +162,7 @@ RUN aptitude install -y libboost-mpi-dev libboost-serialization${BOOST_VERSION}-
RUN export BUILD_PACKAGES="git g++ gfortran autoconf automake make python" && \
aptitude install -y ${BUILD_PACKAGES} && \
mkdir -p ${INSTALLDIR}/blitz && \
git clone --branch ${BLITZ_VERSION//latest/master} https://github.com/blitzpp/blitz.git ${INSTALLDIR}/blitz/blitz-${BLITZ_VERSION} && \
git clone --depth 1 --shallow-submodules --branch ${BLITZ_VERSION//latest/master} https://github.com/blitzpp/blitz.git ${INSTALLDIR}/blitz/blitz-${BLITZ_VERSION} && \
cd ${INSTALLDIR}/blitz/blitz-${BLITZ_VERSION} && \
autoreconf -fiv && ./configure --prefix=${INSTALLDIR}/blitz/ && \
make -j ${J} lib && \
......@@ -190,7 +190,7 @@ RUN aptitude install -y libhdf5-${LIBHDF5_VERSION} python3 && \
RUN export BUILD_PACKAGES="git cmake g++ swig3.0 python3-setuptools python3-dev libhdf5-dev" && \
aptitude install -y ${BUILD_PACKAGES} && \
mkdir -p ${INSTALLDIR}/DAL/build && \
git clone --branch ${DAL_VERSION//latest/master} https://github.com/nextgen-astrodata/DAL.git ${INSTALLDIR}/DAL/DAL.src && \
git clone --depth 1 --shallow-submodules --branch ${DAL_VERSION//latest/master} https://github.com/nextgen-astrodata/DAL.git ${INSTALLDIR}/DAL/DAL.src && \
cd ${INSTALLDIR}/DAL/build && \
cmake -DPYTHON_INCLUDE_DIR=/usr/include/python${PYTHON_VERSION} -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython${PYTHON_VERSION}m.so -DBUILD_TESTING=OFF -DCMAKE_CXX_FLAGS="${CXX_FLAGS} -fpermissive" -DCMAKE_INSTALL_PREFIX=${INSTALLDIR}/DAL ${INSTALLDIR}/DAL/DAL.src && \
make -j ${J} && \
......@@ -219,7 +219,7 @@ ENV LOFAR_FINGERPRINT=${LOFAR_FINGERPRINT}
RUN export BUILD_PACKAGES="git cmake g++ gfortran python3-setuptools bison flex libncurses-dev liblog4cplus-dev libboost${BOOST_VERSION}-all-dev libboost-python${BOOST_VERSION}-dev python3-dev libxml2-dev pkg-config libpng-dev liblapack-dev libfftw3-dev libunittest++-dev libxml++${LIBXMLPP_VERSION}-dev libgsl-dev libreadline-dev binutils-dev libcfitsio-dev wcslib-dev libopenblas-dev libqpid-proton-dev libqpid-proton-cpp-dev libpqxx-dev libhdf5-dev" && \
aptitude install -y ${BUILD_PACKAGES} && \
mkdir -p ${INSTALLDIR}/lofar/build/${LOFAR_BUILDVARIANT} && \
git clone --branch ${LOFAR_VERSION//latest/master} https://git.astron.nl/ro/lofar.git ${INSTALLDIR}/lofar/src && \
git clone --depth 1 --shallow-submodules --branch ${LOFAR_VERSION//latest/master} https://git.astron.nl/ro/lofar.git ${INSTALLDIR}/lofar/src && \
cd ${INSTALLDIR}/lofar/build/${LOFAR_BUILDVARIANT} && \
sed -i "s/ABI=0/ABI=${CXX_ABI}/g" ../../src/CMake/variants/GNUCXX11.cmake && \
cmake -DCMAKE_CXX_FLAGS="${CXX_FLAGS}" -DBUILD_PACKAGES=Offline -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=${INSTALLDIR}/lofar/ -DPYTHON_EXECUTABLE=/usr/bin/python3 -DCASAREST_ROOT_DIR=${INSTALLDIR}/casarest/ -DCASACORE_ROOT_DIR=${INSTALLDIR}/casacore/ -DBLITZ_ROOT_DIR=${INSTALLDIR}/blitz -DAOFLAGGER_ROOT_DIR=${INSTALLDIR}/aoflagger/ -DBDSF_ROOT_DIR=${INSTALLDIR}/pybdsf/lib/python${PYTHON_VERSION}/site-packages/ -DQPID_ROOT_DIR=/opt/qpid/ -DUSE_OPENMP=True ${INSTALLDIR}/lofar/src/ && \
......
......@@ -30,13 +30,11 @@
#include <Common/ParameterSet.h>
#include <Common/lofar_tribool.h>
using namespace LOFAR::ACC::PLC;
namespace LOFAR {
namespace ACC {
//# Description of class.
class APCmdImpl : public ProcessControl
class APCmdImpl : public LOFAR::ACC::PLC::ProcessControl
{
public:
// Default constructable
......@@ -60,7 +58,7 @@ public:
string askInfo (const string& keylist);
// Make runstate test available
bool inRunState() const { return (ProcessControl::inRunState()); };
bool inRunState() const { return (LOFAR::ACC::PLC::ProcessControl::inRunState()); };
protected:
// Copying is not allowed
......
......@@ -9,7 +9,6 @@ endif(USE_PYTHON)
include(LofarFindPackage)
lofar_find_package(QPID)
lofar_find_package(LibXMLxx)
lofar_find_package(UnitTest++)
add_subdirectory(include/MessageBus)
......
......@@ -30,10 +30,6 @@
#include <MessageBus/NoQpidFallback.h>
#endif
#ifdef HAVE_LIBXMLXX
#include <libxml++/parsers/domparser.h>
#endif
#include <string>
#include <ostream>
#include <Common/Exception.h>
......
......@@ -23,10 +23,6 @@
#ifndef LOFAR_MESSAGEBUS_XMLDOC_H
#define LOFAR_MESSAGEBUS_XMLDOC_H
#ifdef HAVE_LIBXMLXX
#include <libxml++/parsers/domparser.h>
#endif
#include <string>
#include <ostream>
......@@ -40,11 +36,6 @@ class XMLDoc
public:
XMLDoc(const std::string &);
#ifdef HAVE_LIBXMLXX
// Allow copying even though we have non-copyable mmbers
XMLDoc(const XMLDoc &);
#endif
// Extract a subset from another XML document
XMLDoc(const XMLDoc &other, const std::string &key);
......@@ -65,23 +56,7 @@ public:
void insertXML(const std::string& key, const std::string& xml);
protected:
#ifdef HAVE_LIBXMLXX
// Locates and returns a node given by its XPATH key ("/a/b/c")
xmlpp::Element *getXMLnode(const std::string &name) const;
#endif
// -- datamembers --
#ifdef HAVE_LIBXMLXX
// itsParser is the owner of the XML Document and Elements that
// will be accessed. It takes care of the memory management and
// thus free all elements at destruction.
//
// If itsParser == 0, we did not use a parser, and we own itsDocument.
xmlpp::DomParser *itsParser; // NOTE: non-copyable
xmlpp::Document *itsDocument; // NOTE: non-copyable
#else
std::string itsContent;
#endif
};
inline std::ostream &operator<<(std::ostream &os, const XMLDoc &xml)
......
......@@ -30,14 +30,6 @@
#include <Common/LofarLogger.h>
#include <Common/StringUtil.h>
#ifdef HAVE_LIBXMLXX
#include <sstream>
#include <libxml++/parsers/domparser.h>
#include <libxml++/nodes/textnode.h>
using namespace xmlpp;
#endif
using namespace std;
using namespace LOFAR::StringUtil;
......@@ -45,54 +37,11 @@ namespace LOFAR {
XMLDoc::XMLDoc(const std::string &content)
{
#ifdef HAVE_LIBXMLXX
itsParser = new DomParser;
try {
itsParser->parse_memory(content);
itsDocument = itsParser->get_document();
} catch(xmlpp::exception &e) {
delete itsParser;
THROW(XMLException, "Could not parse XML: " << e.what());
}
#else
itsContent = content;
#endif
}
#ifdef HAVE_LIBXMLXX
XMLDoc::XMLDoc(const XMLDoc &other)
{
itsParser = new DomParser;
try {
itsParser->parse_memory(other.getContent());
itsDocument = itsParser->get_document();
} catch(xmlpp::exception &e) {
delete itsParser;
THROW(XMLException, "Could not parse XML: " << e.what());
}
}
#endif
XMLDoc::XMLDoc(const XMLDoc &other, const std::string &key)
{
#ifdef HAVE_LIBXMLXX
itsParser = 0;
itsDocument = 0;
try {
itsDocument = new Document;
itsDocument->create_root_node_by_import(other.getXMLnode(key));
} catch(xmlpp::exception &e) {
delete itsDocument;
THROW(XMLException, "Could not parse XML: " << e.what());
}
#else
const string content = other.getXMLvalue(key);
// Extract root element (last element in 'key')
......@@ -101,42 +50,19 @@ XMLDoc::XMLDoc(const XMLDoc &other, const std::string &key)
const string root_element = labels[labels.size()-1];
itsContent = formatString("<%s>%s</%s>", root_element.c_str(), other.getXMLvalue(key).c_str(), root_element.c_str());
#endif
}
XMLDoc::~XMLDoc()
{
#ifdef HAVE_LIBXMLXX
if (itsParser != NULL) {
// We used a parser, it owns the document
delete itsParser;
} else {
// We own the document
delete itsDocument;
}
#endif
}
std::string XMLDoc::getContent() const
{
#ifdef HAVE_LIBXMLXX
return itsDocument->write_to_string_formatted();
#else
return itsContent;
#endif
}
string XMLDoc::getXMLvalue(const string& key) const
{
#ifdef HAVE_LIBXMLXX
Element *e = getXMLnode(key);
// Extract the text, if any
TextNode *t = e->get_child_text();
if (!t) return "";
return t->get_content();
#else
// get copy of content
vector<string> labels = split(key, '/');
......@@ -163,16 +89,10 @@ string XMLDoc::getXMLvalue(const string& key) const
THROW(XMLException, "XML element not found (could not find end tag): " << key);
}
return (itsContent.substr(begin, end - begin));
#endif
}
void XMLDoc::setXMLvalue(const string& key, const string &data)
{
#ifdef HAVE_LIBXMLXX
Element *e = getXMLnode(key);
e->set_child_text(data);
#else
// get copy of content
vector<string> labels = split(key, '/');
......@@ -200,59 +120,11 @@ void XMLDoc::setXMLvalue(const string& key, const string &data)
}
itsContent.replace(begin, end - begin, data);
#endif
}
void XMLDoc::insertXML(const string &key, const string &xml)
{
#ifdef HAVE_LIBXMLXX
// Find insert spot
Element *e = getXMLnode(key);
try {
// Parse provided XML
DomParser parser;
parser.parse_memory(xml);
Document *document = parser.get_document();
ASSERT(document);
Element *root = document->get_root_node();
ASSERT(root);
// Insert the XML into our document
e->import_node(root);
} catch(xmlpp::exception &e) {
THROW(XMLException, "Could not parse XML: " << e.what());
}
#else
setXMLvalue(key, xml);
#endif
}
#ifdef HAVE_LIBXMLXX
Element *XMLDoc::getXMLnode(const string &name) const
{
Element *root = itsDocument->get_root_node();
ASSERT(root);
// assume key is an XPath relative to root, see http://www.w3schools.com/xpath/xpath_syntax.asp
NodeSet nodeset = root->find("/" + name);
if (nodeset.empty()) {
// Element not found
THROW(XMLException, "XML element not found: /" << name);
}
Element *e = dynamic_cast<Element*>(nodeset[0]);
if (!e) {
// Key points to a special element
THROW(XMLException, "XML element not a text element: /" << name);
}
return e;
}
#endif
} // namespace LOFAR
......@@ -194,7 +194,14 @@ class MessageContent(object):
# builds, skip encode if XML tags continue in <payload>. Hack ahead!
if qpidMsg.body is None:
qpidMsg.body = '' # avoid find() or replace() via escape() on None
if isinstance(qpidMsg.body, bytes):
qpidMsg.body = qpidMsg.body.decode('utf-8')
plIdx = qpidMsg.body.find('<payload>')
if isinstance(qpidMsg.body, bytes):
qpidMsg.body = qpidMsg.body.decode('utf-8')
if plIdx != -1:
plIdx += len('<payload>')
plEndIdx = qpidMsg.body.rfind('</payload>', plIdx)
......
......@@ -17,6 +17,8 @@ if(HAVE_QPID)
lofar_add_test(tMessageBus tMessageBus.cc)
endif(HAVE_UNITTEST++)
lofar_add_test(tPyMsgBus)
lofar_add_test(tPyProtocols)
if(USE_PYTHON)
lofar_add_test(tPyMsgBus)
lofar_add_test(tPyProtocols)
endif(USE_PYTHON)
endif(HAVE_QPID)
......@@ -34,16 +34,6 @@ SUITE(Parsing) {
XMLDoc doc("<foo></foo>");
}
#ifdef HAVE_LIBXMLXX
TEST(EmptyXML) {
CHECK_THROW(XMLDoc(""), XMLException);
}
TEST(InvalidXML) {
CHECK_THROW(XMLDoc("<foo>"), XMLException);
}
#endif
TEST(Subdocument) {
XMLDoc base("<foo><bar>x</bar></foo>");
XMLDoc derived(base, "foo/bar");
......@@ -75,9 +65,6 @@ TEST(insertXML) {
CHECK_EQUAL("y", doc.getXMLvalue("foo/bar/baz"));
CHECK_THROW(doc.insertXML("invalid", "<baz>y</baz>"), XMLException);
#ifdef HAVE_LIBXMLXX
CHECK_THROW(doc.insertXML("foo/bar", "<invalid>"), XMLException);
#endif
}
TEST(getContent) {
......
......@@ -6,7 +6,6 @@ include(LofarFindPackage)
lofar_find_package(QPID REQUIRED) # MessageBus may be able to fake it without QPID, but running the daemons without QPID is ridiculous.
add_subdirectory(src)
add_subdirectory(test)
add_subdirectory(webmonitor)
lofar_add_package(ObservationStartListener)
......@@ -6,7 +6,6 @@ include(LofarFindPackage)
lofar_find_package(Python 3.4 REQUIRED)
lofar_find_package(QPID)
lofar_find_package(LibXMLxx)
add_subdirectory(etc)
add_subdirectory(src)
......
......@@ -120,7 +120,7 @@ def processMessages(receiver, matchPrefix, execPath, msgSaveDir):
messageFilename = msgSaveDir + 'L' + obsId + '.parset.xml'
try:
saveData(messageFilename, message)
saveData(messageFilename, message.encode('utf-8'))
hosts = uniq(hosts)
hosts.sort()
......@@ -139,7 +139,7 @@ def processMessages(receiver, matchPrefix, execPath, msgSaveDir):
finally:
if msg is not None:
receiver.ack() # optional for topics, needed for queues
receiver.ack(msg) # optional for topics, needed for queues
def run(broker, address, matchPrefix, execPath, msgSaveDir):
# Receiver test: qpid-receive -b broker_hostname -a queue_or_exchange_name -f -m 1
......
......@@ -26,7 +26,7 @@ send_msg $QUEUE "`cat tObservationStartListener.parset.correct.match.msg.xml`"
# Msg 4: Redo Msg 3
send_msg $QUEUE "`cat tObservationStartListener.parset.correct.match.msg.xml`"
sleep 0.5 # wait for executed program triggered by Msg 3 & 4 to finish
sleep 4 # wait for executed program triggered by Msg 3 & 4 to finish
kill -s SIGTERM $pid 2>/dev/null
wait $pid || : # mask exit status for bash -e
echo
......
# $Id$
include(LofarCTest)
message(STATUS "QPID_FOUND = ${QPID_FOUND}")
message(STATUS "HAVE_QPID = ${HAVE_QPID}")
if(HAVE_QPID)
lofar_add_test(tMessageRouter)
endif(HAVE_QPID)
# t_messagebus.py: Test program for the module lofar.messaging.messagebus
#
# Copyright (C) 2015
# ASTRON (Netherlands Institute for Radio Astronomy)
# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
#
# This file is part of the LOFAR software suite.
# The LOFAR software suite 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.
#
# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>.
#
# $Id$
"""
Test program for the module lofar.messaging.messagebus
"""
from copy import deepcopy
import os
import unittest
import logging
logger = logging.getLogger(__name__)
from lofar.messaging.messages import *
from lofar.messaging.messagebus import *
from subprocess import Popen
from signal import SIGINT
class TestMessageRouter(unittest.TestCase):
"""Test the MessageRouter class"""
def test_1(self):
"""
test 1
"""
with TemporaryQueue("in") as in_queue, \
TemporaryQueue("out1") as out1_queue, \
TemporaryQueue("out2") as out2_queue:
# write config file in cur working dir, so MessageRouter uses our tmp queues
config = "[multicast]\n%s: %s, %s\n" % (in_queue.address,out1_queue.address, out2_queue.address)
with open("MessageRouter.conf", 'w') as config_file:
config_file.write(config)
# create 2 receivers
with out1_queue.create_frombus() as recveiver1, \
out2_queue.create_frombus() as recveiver2:
# start a MessageRouter (which reads the config in cur-work-dir with our tmp queues)
# "fake" the PRODUCTION LOFARENV environment, so the queue names are not messed up.
env = deepcopy(os.environ)
env['LOFARENV'] = 'PRODUCTION'
proc = Popen(["MessageRouter"], env=env)
msg_in = EventMessage(content="foo")
with in_queue.create_tobus() as sender:
sender.send(msg_in)
msg_out1 = recveiver1.receive()
msg_out2 = recveiver2.receive()
self.assertEqual(msg_in.id, msg_out1.id)
self.assertEqual(msg_in.id, msg_out2.id)
self.assertEqual(msg_in.body, msg_out1.body)
self.assertEqual(msg_in.body, msg_out2.body)
proc.send_signal(SIGINT)
self.assertEqual(0, proc.wait(5))