#!/bin/bash
##############################################################################
# Copyright (c) Members of the EGEE Collaboration. 2004.
# See http://www.eu-egee.org/partners/ for details on the copyright
# holders.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS
# OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
##############################################################################
#
# AUTHORS: Fabrizio Furano <fabrizio.furano@cern.ch>
#          (original author: Dimitar Shiyachki <Dimitar.Shiyachki@cern.ch>)
#
##############################################################################
# meta: proxy=true
# meta: preconfig=../../LFC-config

SCRIPTDIR="$(dirname "$(readlink -f ${BASH_SOURCE})")"
source "${SCRIPTDIR}/../../Macros"

test_check-semsg-build_pre () {
   return 0
}

test_check-semsg-build_post () {

   return 0
}



test_check-semsg-build () {

   LFC_HOST_EXEC "grep -i semsg /var/log/lfc/log"

   if [ $? -ne 0 ]; then
      echo "No trace of SEMsg"
      return 1
   fi

   LFC_HOST_EXEC "grep -i \"SEMsg C producer was correctly initialized\" /var/log/lfc/log"

   if [ $? -ne 0 ]; then
      echo "SEMsg was not properly initialized, but still there."
      return 0
   fi

   return 0
}

if (test_check-semsg-build_pre); then
  if (test_check-semsg-build); then
    if (test_check-semsg-build_post); then
      TEST_PASSED
    else
      TEST_FAILED
    fi
  else
    test_check-semsg-build
    TEST_FAILED
  fi
else
  TEST_FAILED
fi

