From ce3b800b82945f0feeaa98fcbc2d9f30d33324a8 Mon Sep 17 00:00:00 2001 From: blaakmeer <sdos@astron.nl> Date: Thu, 15 Jun 2006 09:46:30 +0000 Subject: [PATCH] BugID: 654 Added GCF test application services to the ServiceInfo file Added code to test writing properties at the end of the application's lifetime --- .../GCFCommon/include/GCF/GCF_ServiceInfo.h | 3 ++ MAC/Test/GCF/MAC/src/Application1.cc | 46 ++++++++++++++++++- MAC/Test/GCF/MAC/src/Application1.h | 2 + MAC/Test/GCF/MAC/src/Application2.cc | 14 +++--- 4 files changed, 57 insertions(+), 8 deletions(-) diff --git a/MAC/GCF/GCFCommon/include/GCF/GCF_ServiceInfo.h b/MAC/GCF/GCFCommon/include/GCF/GCF_ServiceInfo.h index 688a04e9fcf..60e91704685 100644 --- a/MAC/GCF/GCFCommon/include/GCF/GCF_ServiceInfo.h +++ b/MAC/GCF/GCFCommon/include/GCF/GCF_ServiceInfo.h @@ -64,6 +64,9 @@ namespace LOFAR { +// Define names for GCF test applications +#define MAC_SVCMASK_GCFTEST_ST3SERVER "ST3%s:server" +#define MAC_SVCMASK_GCFTEST_ST3PROVIDER "ST3%s:provider" diff --git a/MAC/Test/GCF/MAC/src/Application1.cc b/MAC/Test/GCF/MAC/src/Application1.cc index ba52eeedb80..57fb1895f1b 100644 --- a/MAC/Test/GCF/MAC/src/Application1.cc +++ b/MAC/Test/GCF/MAC/src/Application1.cc @@ -13,6 +13,7 @@ #include <GCF/LogSys/GCF_KeyValueLogger.h> #include <math.h> #include <stdio.h> +#include <unistd.h> #include "TST_Protocol.ph" #include <Suite/suite.h> @@ -62,6 +63,19 @@ Application::Application() : _propertySetB3.initProperties(propertiesSB3); } +Application::~Application() +{ + // the following values do not end up in the PVSS database + TESTC(_propertySetA1.setValue("F.P4", "99") == GCF_NO_ERROR); + TESTC(_propertySetE1.setValue("P5", "99") == GCF_NO_ERROR); + TESTC(_propertySetXX.setValue("P5", "99") == GCF_NO_ERROR); + TESTC(_propertySetB1.setValue("P1", "99") == GCF_NO_ERROR); + TESTC(_propertySetB2.setValue("P1", "99") == GCF_NO_ERROR); + TESTC(_propertySetB3.setValue("P1", "99") == GCF_NO_ERROR); + +} + + GCFEvent::TResult Application::initial(GCFEvent& e, GCFPortInterface& /*p*/) { GCFEvent::TResult status = GCFEvent::HANDLED; @@ -224,6 +238,7 @@ GCFEvent::TResult Application::test2_1(GCFEvent& e, GCFPortInterface& p) { TESTC(strcmp(pResponse->pScope, _propertySetA1.getFullScope().c_str()) == 0); TESTC(pResponse->result == GCF_NO_ERROR); + TESTC(_propertySetA1.setValue("F.P4", "21") == GCF_NO_ERROR); } TESTC(&p == &_supTask1.getPort()); TESTC(_propertySetA1.isEnabled()); @@ -300,6 +315,7 @@ GCFEvent::TResult Application::test2_3(GCFEvent& e, GCFPortInterface& p) { TESTC(strcmp(pResponse->pScope, _propertySetB1.getFullScope().c_str()) == 0); TESTC(pResponse->result == GCF_NO_ERROR); + TESTC(_propertySetB1.setValue("P1", "23") == GCF_NO_ERROR); } TESTC(&p == &_supTask1.getPort()); TESTC(_propertySetB1.isEnabled()); @@ -367,6 +383,7 @@ GCFEvent::TResult Application::test2_5(GCFEvent& e, GCFPortInterface& p) TESTC(strcmp(pResponse->pScope, _propertySetB3.getFullScope().c_str()) == 0); TESTC(&p == &_supTask2.getPort()); TESTC(_propertySetB3.isEnabled()); + TESTC(_propertySetB3.setValue("P1", "25") == GCF_NO_ERROR); TESTC_DESCR(GCFPVSSInfo::propExists("A_E__enabled"), "may fail"); } } @@ -465,6 +482,7 @@ GCFEvent::TResult Application::test3_4(GCFEvent& e, GCFPortInterface& p) { TESTC(strcmp(pResponse->pScope, _propertySetXX.getFullScope().c_str()) == 0); TESTC(pResponse->result != GCF_NO_ERROR); + TESTC(_propertySetXX.setValue("P5", "34") == GCF_NO_ERROR); } TESTC(&p == &_supTask1.getPort()); TESTC(!_propertySetXX.isEnabled()); @@ -650,6 +668,7 @@ GCFEvent::TResult Application::test5_1(GCFEvent& e, GCFPortInterface& /*p*/) TESTC(strcmp(pResponse->pScope, _propertySetE1.getFullScope().c_str()) == 0); TESTC(strcmp(pResponse->pApcName, "e1") == 0); TESTC_ABORT_ON_FAIL(pResponse->result == GCF_NO_ERROR); + TESTC(_propertySetE1.setValue("P5", "51") == GCF_NO_ERROR); TSTTestreadyEvent r; r.testnr = 501; @@ -1070,7 +1089,8 @@ GCFEvent::TResult Application::test6_5(GCFEvent& e, GCFPortInterface& p) _counter++; if (_counter == 2 ) { - NEXT_TEST(6_6, "Send and receive properties between tasks, test stability and performance"); +// NEXT_TEST(6_6, "Send and receive properties between tasks, test stability and performance"); + FINISH; } break; } @@ -1290,9 +1310,31 @@ GCFEvent::TResult Application::finished(GCFEvent& e, GCFPortInterface& /*p*/) { _supTask1.getPort().send(r); } - GCFTask::stop(); + + // the following values end up in the PVSS database + TESTC(_propertySetA1.setValue("F.P4", "97") == GCF_NO_ERROR); + TESTC(_propertySetE1.setValue("P5", "97") == GCF_NO_ERROR); + TESTC(_propertySetXX.setValue("P5", "97") == GCF_NO_ERROR); + TESTC(_propertySetB1.setValue("P1", "97") == GCF_NO_ERROR); + TESTC(_propertySetB2.setValue("P1", "97") == GCF_NO_ERROR); + TESTC(_propertySetB3.setValue("P1", "97") == GCF_NO_ERROR); + + _supTask1.getPort().setTimer(1.0); break; } + + case F_TIMER: + // the following values do not end up in the PVSS database + TESTC(_propertySetA1.setValue("F.P4", "98") == GCF_NO_ERROR); + TESTC(_propertySetE1.setValue("P5", "98") == GCF_NO_ERROR); + TESTC(_propertySetXX.setValue("P5", "98") == GCF_NO_ERROR); + TESTC(_propertySetB1.setValue("P1", "98") == GCF_NO_ERROR); + TESTC(_propertySetB2.setValue("P1", "98") == GCF_NO_ERROR); + TESTC(_propertySetB3.setValue("P1", "98") == GCF_NO_ERROR); + sleep(5); + GCFTask::stop(); + break; + default: status = GCFEvent::NOT_HANDLED; break; diff --git a/MAC/Test/GCF/MAC/src/Application1.h b/MAC/Test/GCF/MAC/src/Application1.h index 01da1351a53..a80d95a5b47 100644 --- a/MAC/Test/GCF/MAC/src/Application1.h +++ b/MAC/Test/GCF/MAC/src/Application1.h @@ -23,6 +23,8 @@ class Application : public TM::GCFTask, public ::Test { public: Application(); + virtual ~Application(); + void run(); private: diff --git a/MAC/Test/GCF/MAC/src/Application2.cc b/MAC/Test/GCF/MAC/src/Application2.cc index 0b59db27235..16ec9ad9f10 100644 --- a/MAC/Test/GCF/MAC/src/Application2.cc +++ b/MAC/Test/GCF/MAC/src/Application2.cc @@ -5,6 +5,7 @@ #include <GCF/GCF_PVInteger.h> #include <GCF/GCF_PVDouble.h> #include <GCF/GCF_PVString.h> +#include <GCF/GCF_ServiceInfo.h> #include <GCF/PAL/GCF_Property.h> #include <GCF/PAL/GCF_ExtProperty.h> #include <GCF/PAL/GCF_PVSSInfo.h> @@ -64,7 +65,7 @@ GCFEvent::TResult Application::initial(GCFEvent& e, GCFPortInterface& /*p*/) switch (e.signal) { case F_INIT: - _supTask3.getPort().init(_supTask3, "server", GCFPortInterface::SPP, TST_PROTOCOL); + _supTask3.getPort().init(_supTask3, MAC_SVCMASK_GCFTEST_ST3SERVER, GCFPortInterface::SPP, TST_PROTOCOL); NEXT_TEST(1_1, "Port connection, one client, one server"); break; @@ -138,13 +139,13 @@ GCFEvent::TResult Application::test1_2(GCFEvent& e, GCFPortInterface& p) if (_pSTPort1 == 0) { _pSTPort1 = new GCFTCPPort(); - _pSTPort1->init(_supTask3, "server", GCFPortInterface::SPP, TST_PROTOCOL); + _pSTPort1->init(_supTask3, MAC_SVCMASK_GCFTEST_ST3SERVER, GCFPortInterface::SPP, TST_PROTOCOL); TESTC(_port.accept(*_pSTPort1)); } else { _pSTPort2 = new GCFTCPPort(); - _pSTPort2->init(_supTask3, "server", GCFPortInterface::SPP, TST_PROTOCOL); + _pSTPort2->init(_supTask3, MAC_SVCMASK_GCFTEST_ST3SERVER, GCFPortInterface::SPP, TST_PROTOCOL); TESTC(_port.accept(*_pSTPort2)); } break; @@ -152,7 +153,7 @@ GCFEvent::TResult Application::test1_2(GCFEvent& e, GCFPortInterface& p) case F_DISCONNECTED: if (closing) { - _port.init(_supTask3, "provider", GCFPortInterface::MSPP, TST_PROTOCOL); + _port.init(_supTask3, MAC_SVCMASK_GCFTEST_ST3PROVIDER, GCFPortInterface::MSPP, TST_PROTOCOL); TESTC(_port.open()); closing = false; } @@ -164,7 +165,7 @@ GCFEvent::TResult Application::test1_2(GCFEvent& e, GCFPortInterface& p) break; case F_CLOSED: - _port.init(_supTask3, "provider", GCFPortInterface::MSPP, TST_PROTOCOL); + _port.init(_supTask3, MAC_SVCMASK_GCFTEST_ST3PROVIDER, GCFPortInterface::MSPP, TST_PROTOCOL); TESTC(_port.open()); closing = false; break; @@ -973,7 +974,8 @@ GCFEvent::TResult Application::test6_5(GCFEvent& e, GCFPortInterface& /*p*/) _counter++; if (_counter == 2) { - NEXT_TEST(6_6, "Send and receive properties between tasks, test stability and performance"); +// NEXT_TEST(6_6, "Send and receive properties between tasks, test stability and performance"); + FINISH; } break; } -- GitLab