Projekt

Allgemein

Profil

Herunterladen (18,6 KB) Statistiken
| Zweig: | Markierung: | Revision:


#include <aqfinance/engine/ae.h>

#include <aqdatabase/aqdb_db.h>
#include <aqdatabase/aqdb_value.h>

#include <aqfinance/engine/book/ae_book.h>
#include <aqfinance/engine/modules/ae_statementimport.h>
#include <aqfinance/engine/modules/ae_recontransfers.h>

#include <aqbanking/imexporter.h>

#include <gwenhywfar/gwenhywfar.h>
#include <gwenhywfar/debug.h>
#include <gwenhywfar/logger.h>
#include <gwenhywfar/db.h>

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>


#define DB_URL1 "dir:///tmp/aqfinance-db1"
#define DB_URL2 "dir:///tmp/aqfinance-db2"



int readContext(const char *ctxFile,
AB_IMEXPORTER_CONTEXT **pCtx,
int mustExist) {
#if 0
AB_IMEXPORTER_CONTEXT *ctx;
int fd;

if (ctxFile==0)
fd=fileno(stdin);
else
fd=open(ctxFile, O_RDONLY);
if (fd<0) {
if (!mustExist) {
ctx=AB_ImExporterContext_new();
*pCtx=ctx;
return 0;
}
DBG_ERROR(0, "open(%s): %s", ctxFile, strerror(errno));
return GWEN_ERROR_IO;
}
else {
GWEN_DB_NODE *dbCtx;
int rv;

dbCtx=GWEN_DB_Group_new("context");
rv=GWEN_DB_ReadFromFd(dbCtx, fd,
GWEN_DB_FLAGS_DEFAULT |
GWEN_PATH_FLAGS_CREATE_GROUP,
0,
2000);
if (ctxFile)
close(fd);
if (rv<0) {
DBG_ERROR(0, "Error reading context file (%d)", rv);
GWEN_DB_Group_free(dbCtx);
return rv;
}

ctx=AB_ImExporterContext_fromDb(dbCtx);
if (!ctx) {
DBG_ERROR(0, "No context in input data");
GWEN_DB_Group_free(dbCtx);
return GWEN_ERROR_BAD_DATA;
}
GWEN_DB_Group_free(dbCtx);
*pCtx=ctx;
}

return 0;
#else
return -1;
#endif
}


int test_db_factory() {
AQDB_DB *db=NULL;
int rv;

rv=AE_DbFactory(DB_URL1, &db);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to instantiate db (%d)\n", rv);
return 2;
}
AQDB_DB_free(db);

return 0;
}



int test_db_create() {
AQDB_DB *db=NULL;
int rv;

rv=AE_DbFactory(DB_URL1, &db);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to instantiate db (%d)\n", rv);
return 2;
}

rv=AQDB_DB_Create(db, 0);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to create db (%d)\n", rv);
AQDB_DB_free(db);
return 2;
}

AQDB_DB_free(db);

return 0;
}



int test_book_create() {
AQDB_DB *db=NULL;
AE_BOOK *b;
int rv;

rv=AE_DbFactory(DB_URL2, &db);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to instantiate db (%d)\n", rv);
return 2;
}

b=AE_Book_new(db);

rv=AE_Book_Create(b, 0);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to create book (%d)\n", rv);
AE_Book_free(b);
return 2;
}

AE_Book_free(b);

return 0;
}



int test_book_open() {
AQDB_DB *db=NULL;
AE_BOOK *b;
int rv;

rv=AE_DbFactory(DB_URL2, &db);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to instantiate db (%d)\n", rv);
return 2;
}

b=AE_Book_new(db);

rv=AE_Book_Open(b, AQDB_ACTION_FLAGS_READ | AQDB_ACTION_FLAGS_WRITE);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to open book (%d)\n", rv);
AE_Book_free(b);
return 2;
}

AE_Book_free(b);

return 0;
}



int test_book_setup() {
AQDB_DB *db=NULL;
AE_BOOK *b;
int rv;

rv=AE_DbFactory(DB_URL2, &db);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to instantiate db (%d)\n", rv);
return 2;
}

b=AE_Book_new(db);

rv=AE_Book_Open(b, AQDB_ACTION_FLAGS_READ | AQDB_ACTION_FLAGS_WRITE);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to open book (%d)\n", rv);
AE_Book_free(b);
return 2;
}

rv=AE_Book_CreateTable(b, AE_Book_TableType_IdCounter, 0);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to create table 1 (%d)\n", rv);
AE_Book_free(b);
return 2;
}

rv=AE_Book_CreateTable(b, AE_Book_TableType_Commodity, 0);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to create table 2 (%d)\n", rv);
AE_Book_free(b);
return 2;
}

rv=AE_Book_CreateTable(b, AE_Book_TableType_Account, 0);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to create table 3 (%d)\n", rv);
AE_Book_free(b);
return 2;
}

rv=AE_Book_CreateTable(b, AE_Book_TableType_BankAccount, 0);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to create table 4 (%d)\n", rv);
AE_Book_free(b);
return 2;
}

rv=AE_Book_CreateTable(b, AE_Book_TableType_BankStatement, 0);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to create table 5 (%d)\n", rv);
AE_Book_free(b);
return 2;
}

rv=AE_Book_CreateTable(b, AE_Book_TableType_BankTransfer, 0);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to create table 6 (%d)\n", rv);
AE_Book_free(b);
return 2;
}

AE_Book_free(b);

return 0;
}



int test_book_opentable() {
AQDB_DB *db=NULL;
AE_BOOK *b;
int rv;

rv=AE_DbFactory(DB_URL2, &db);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to instantiate db (%d)\n", rv);
return 2;
}

b=AE_Book_new(db);

rv=AE_Book_Open(b, AQDB_ACTION_FLAGS_READ | AQDB_ACTION_FLAGS_WRITE);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to open book (%d)\n", rv);
AE_Book_free(b);
return 2;
}

rv=AE_Book_OpenTable(b, AE_Book_TableType_IdCounter,
AQDB_ACTION_FLAGS_READ | AQDB_ACTION_FLAGS_WRITE);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to open table 1 (%d)\n", rv);
AE_Book_free(b);
return 2;
}

rv=AE_Book_OpenTable(b, AE_Book_TableType_Commodity,
AQDB_ACTION_FLAGS_READ | AQDB_ACTION_FLAGS_WRITE);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to open table 2 (%d)\n", rv);
AE_Book_free(b);
return 2;
}

rv=AE_Book_OpenTable(b, AE_Book_TableType_Account,
AQDB_ACTION_FLAGS_READ | AQDB_ACTION_FLAGS_WRITE);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to open table 3 (%d)\n", rv);
AE_Book_free(b);
return 2;
}

rv=AE_Book_OpenTable(b, AE_Book_TableType_BankAccount,
AQDB_ACTION_FLAGS_READ | AQDB_ACTION_FLAGS_WRITE);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to open table 4 (%d)\n", rv);
AE_Book_free(b);
return 2;
}

rv=AE_Book_OpenTable(b, AE_Book_TableType_BankStatement,
AQDB_ACTION_FLAGS_READ | AQDB_ACTION_FLAGS_WRITE);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to open table 5 (%d)\n", rv);
AE_Book_free(b);
return 2;
}

rv=AE_Book_OpenTable(b, AE_Book_TableType_BankTransfer,
AQDB_ACTION_FLAGS_READ | AQDB_ACTION_FLAGS_WRITE);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to open table 6 (%d)\n", rv);
AE_Book_free(b);
return 2;
}


rv=AE_Book_Close(b, 0);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to close book (%d)\n", rv);
AE_Book_free(b);
return 2;
}

AE_Book_free(b);

return 0;
}



int test_book_getnextid() {
AQDB_DB *db=NULL;
AE_BOOK *b;
int rv;
AQDB_ID id=0;

rv=AE_DbFactory(DB_URL2, &db);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to instantiate db (%d)\n", rv);
return 2;
}

b=AE_Book_new(db);

rv=AE_Book_Open(b, AQDB_ACTION_FLAGS_READ | AQDB_ACTION_FLAGS_WRITE);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to open book (%d)\n", rv);
AE_Book_free(b);
return 2;
}

rv=AE_Book_OpenTable(b, AE_Book_TableType_IdCounter,
AQDB_ACTION_FLAGS_READ | AQDB_ACTION_FLAGS_WRITE);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to open table 1 (%d)\n", rv);
AE_Book_free(b);
return 2;
}

rv=AE_Book_BeginEdit(b, 0);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to begin editing (%d)\n", rv);
AE_Book_free(b);
return 2;
}

rv=AE_Book_GetNextId(b, AE_Book_TableType_Account, &id);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to get next id (%d)\n", rv);
AE_Book_EndEdit(b, AQDB_ACTION_FLAGS_ABORT);
AE_Book_free(b);
return 2;
}

rv=AE_Book_EndEdit(b, 0);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to end editing (%d)\n", rv);
AE_Book_free(b);
return 2;
}

rv=AE_Book_Close(b, 0);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to close book (%d)\n", rv);
AE_Book_free(b);
return 2;
}

AE_Book_free(b);

return 0;
}



int test_book_import_transactions() {
AQDB_DB *db=NULL;
AE_BOOK *b;
int rv;
AB_IMEXPORTER_CONTEXT *ctx=NULL;

rv=readContext("test.ctx", &ctx, 1);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to read context (%d)\n", rv);
return 2;
}

rv=AE_DbFactory(DB_URL2, &db);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to instantiate db (%d)\n", rv);
AB_ImExporterContext_free(ctx);
return 2;
}

b=AE_Book_new(db);

rv=AE_Book_Open(b, AQDB_ACTION_FLAGS_READ | AQDB_ACTION_FLAGS_WRITE);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to open book (%d)\n", rv);
AE_Book_free(b);
AB_ImExporterContext_free(ctx);
return 2;
}

rv=AE_Book_OpenTable(b, AE_Book_TableType_IdCounter,
AQDB_ACTION_FLAGS_READ | AQDB_ACTION_FLAGS_WRITE);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to open table 1 (%d)\n", rv);
AE_Book_free(b);
AB_ImExporterContext_free(ctx);
return 2;
}

rv=AE_Book_OpenTable(b, AE_Book_TableType_BankStatement,
AQDB_ACTION_FLAGS_READ | AQDB_ACTION_FLAGS_WRITE);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to open table 1 (%d)\n", rv);
AE_Book_free(b);
AB_ImExporterContext_free(ctx);
return 2;
}

rv=AE_StatementImport_ImportContext(b, ctx, 0);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to import context (%d)\n", rv);
AE_Book_free(b);
AB_ImExporterContext_free(ctx);
return 2;
}

rv=AE_Book_Close(b, 0);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to close book (%d)\n", rv);
AE_Book_free(b);
AB_ImExporterContext_free(ctx);
return 2;
}

AE_Book_free(b);
AB_ImExporterContext_free(ctx);

return 0;
}



int test_book_import_transfers() {
AQDB_DB *db=NULL;
AE_BOOK *b;
int rv;
AB_IMEXPORTER_CONTEXT *ctx=NULL;

rv=readContext("test.ctx", &ctx, 1);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to read context (%d)\n", rv);
return 2;
}

rv=AE_DbFactory(DB_URL2, &db);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to instantiate db (%d)\n", rv);
AB_ImExporterContext_free(ctx);
return 2;
}

b=AE_Book_new(db);

rv=AE_Book_Open(b, AQDB_ACTION_FLAGS_READ | AQDB_ACTION_FLAGS_WRITE);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to open book (%d)\n", rv);
AE_Book_free(b);
AB_ImExporterContext_free(ctx);
return 2;
}

rv=AE_Book_OpenTable(b, AE_Book_TableType_IdCounter,
AQDB_ACTION_FLAGS_READ | AQDB_ACTION_FLAGS_WRITE);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to open table 1 (%d)\n", rv);
AE_Book_free(b);
AB_ImExporterContext_free(ctx);
return 2;
}

rv=AE_Book_OpenTable(b, AE_Book_TableType_BankTransfer,
AQDB_ACTION_FLAGS_READ | AQDB_ACTION_FLAGS_WRITE);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to open table 1 (%d)\n", rv);
AE_Book_free(b);
AB_ImExporterContext_free(ctx);
return 2;
}

rv=AE_StatementImport_ImportContext(b, ctx, 0);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to import context (%d)\n", rv);
AE_Book_free(b);
AB_ImExporterContext_free(ctx);
return 2;
}

rv=AE_Book_Close(b, 0);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to close book (%d)\n", rv);
AE_Book_free(b);
AB_ImExporterContext_free(ctx);
return 2;
}

AE_Book_free(b);
AB_ImExporterContext_free(ctx);

return 0;
}



void _dumpStatement(const AE_STATEMENT *st) {
const GWEN_DATE *ti;
const char *s;
const AQDB_VALUE *v;

ti=AE_Statement_GetDate(st);
if (ti==NULL)
ti=AE_Statement_GetValutaDate(st);
if (ti) {
fprintf(stdout, "%s\t", GWEN_Date_GetString(ti));
}
else
fprintf(stdout, "\t");

fprintf(stdout, "%08x\t", AE_Statement_GetId(st));

s=AE_Statement_GetInfoText(st);
fprintf(stdout, "%s\t", s?s:"");

v=AE_Statement_GetValue(st);
if (v) {
GWEN_BUFFER *tbuf;

tbuf=GWEN_Buffer_new(0, 32, 0, 1);
AQDB_Value_toHumanReadableString(v, tbuf, 2);
fprintf(stdout, "%s\t", GWEN_Buffer_GetStart(tbuf));
GWEN_Buffer_free(tbuf);
}
else
fprintf(stdout, "\t");

s=AE_Statement_GetCurrency(st);
fprintf(stdout, "%s\t", s?s:"");

s=AE_Statement_GetRemoteName(st);
fprintf(stdout, "%s\t", s?s:"");

s=AE_Statement_GetPurpose(st);
fprintf(stdout, "%s\t", s?s:"");

s=AE_Statement_GetLocalBankCode(st);
fprintf(stdout, "%s\t", s?s:"");

s=AE_Statement_GetLocalAccountNumber(st);
fprintf(stdout, "%s\t", s?s:"");

s=AE_Statement_GetRemoteBankCode(st);
fprintf(stdout, "%s\t", s?s:"");

s=AE_Statement_GetRemoteAccountNumber(st);
fprintf(stdout, "%s\t", s?s:"");

fprintf(stdout, "%d\t", AE_Statement_GetTextKey(st));

s=NULL;
switch(AE_Statement_GetStatus(st)) {
case AE_Statement_StatusUnknown: s="unknown"; break;
case AE_Statement_StatusNone: s="none"; break;
case AE_Statement_StatusEnqueued: s="enqueued"; break;
case AE_Statement_StatusSending: s="sending"; break;
case AE_Statement_StatusAccepted: s="accepted"; break;
case AE_Statement_StatusRejected: s="rejected"; break;
case AE_Statement_StatusPending: s="pending"; break;
case AE_Statement_StatusAutoReconciled: s="autorecon"; break;
case AE_Statement_StatusManuallyReconciled: s="manrecon"; break;
case AE_Statement_StatusRevoked: s="revoked"; break;
case AE_Statement_StatusAborted: s="aborted"; break;
}
fprintf(stdout, "%s\t", s?s:"");

fprintf(stdout, "\n");
}



void GWENHYWFAR_CB *_dumpStatementFn(AE_BOOK *bk,
AE_BOOK_TABLE_TYPE tt,
AQDB_OBJECT *o,
void *data) {
AE_STATEMENT *st=NULL;
int rv;

rv=AE_Statement_fromObject(o, &st);
if (rv==0) {
_dumpStatement(st);
AE_Statement_free(st);
}

return NULL;
}



int dumpStatements(AE_BOOK *b, AE_BOOK_TABLE_TYPE tt) {
void *dummy=NULL;
int rv;

rv=AE_Book_ForEveryQueryObject(b,
tt,
0,
NULL,
_dumpStatementFn,
NULL,
&dummy);
if (rv<0) {
if (rv!=GWEN_ERROR_NOT_FOUND) {
DBG_INFO(AE_LOGDOMAIN, "here (%d)", rv);
return rv;
}
DBG_ERROR(0, "No entries found");
}

return 0;
}



int test_book_dump_statements() {
AQDB_DB *db=NULL;
AE_BOOK *b;
int rv;

rv=AE_DbFactory(DB_URL2, &db);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to instantiate db (%d)\n", rv);
return 2;
}

b=AE_Book_new(db);

rv=AE_Book_Open(b, AQDB_ACTION_FLAGS_READ);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to open book (%d)\n", rv);
AE_Book_free(b);
return 2;
}

fprintf(stdout, "Transactions\n");
rv=AE_Book_OpenTable(b, AE_Book_TableType_BankStatement,
AQDB_ACTION_FLAGS_READ);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to open table 1 (%d)\n", rv);
AE_Book_free(b);
return 2;
}

rv=dumpStatements(b, AE_Book_TableType_BankStatement);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to dump statements (%d)\n", rv);
AE_Book_free(b);
return 2;
}

rv=AE_Book_Close(b, 0);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to close book (%d)\n", rv);
AE_Book_free(b);
return 2;
}

AE_Book_free(b);

return 0;
}



int test_book_dump_transfers() {
AQDB_DB *db=NULL;
AE_BOOK *b;
int rv;

rv=AE_DbFactory(DB_URL2, &db);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to instantiate db (%d)\n", rv);
return 2;
}

b=AE_Book_new(db);

rv=AE_Book_Open(b, AQDB_ACTION_FLAGS_READ);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to open book (%d)\n", rv);
AE_Book_free(b);
return 2;
}

rv=AE_Book_OpenTable(b, AE_Book_TableType_BankTransfer,
AQDB_ACTION_FLAGS_READ);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to open table 1 (%d)\n", rv);
AE_Book_free(b);
return 2;
}

fprintf(stdout, "Transfers\n");
rv=dumpStatements(b, AE_Book_TableType_BankTransfer);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to dump statements (%d)\n", rv);
AE_Book_free(b);
return 2;
}

rv=AE_Book_Close(b, 0);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to close book (%d)\n", rv);
AE_Book_free(b);
return 2;
}

AE_Book_free(b);

return 0;
}



int test_book_recon_transfers() {
AQDB_DB *db=NULL;
AE_BOOK *b;
int rv;

rv=AE_DbFactory(DB_URL2, &db);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to instantiate db (%d)\n", rv);
return 2;
}

b=AE_Book_new(db);

rv=AE_Book_Open(b, AQDB_ACTION_FLAGS_READ | AQDB_ACTION_FLAGS_WRITE);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to open book (%d)\n", rv);
AE_Book_free(b);
return 2;
}

rv=AE_Book_OpenTable(b, AE_Book_TableType_BankStatement,
AQDB_ACTION_FLAGS_READ | AQDB_ACTION_FLAGS_WRITE);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to open table 1 (%d)\n", rv);
AE_Book_free(b);
return 2;
}

rv=AE_Book_OpenTable(b, AE_Book_TableType_BankTransfer,
AQDB_ACTION_FLAGS_READ | AQDB_ACTION_FLAGS_WRITE);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to open table 2 (%d)\n", rv);
AE_Book_free(b);
return 2;
}

fprintf(stdout, "Reconciling transfers\n");
rv=AE_ReconTransfers_ReconTransfers(b, 1);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to reconcile transfers (%d)\n", rv);
AE_Book_free(b);
return 2;
}

rv=AE_Book_Close(b, 0);
if (rv<0) {
fprintf(stderr, "ERROR: Unable to close book (%d)\n", rv);
AE_Book_free(b);
return 2;
}

AE_Book_free(b);

return 0;
}


int test() {
int rv;
int errors=0;

rv=test_db_factory();
if (rv)
errors++;
rv=test_db_create();
if (rv)
errors++;

rv=test_book_create();
if (rv)
errors++;

rv=test_book_open();
if (rv)
errors++;

rv=test_book_setup();
if (rv)
errors++;

rv=test_book_opentable();
if (rv)
errors++;

rv=test_book_getnextid();
if (rv)
errors++;

rv=test_book_getnextid();
if (rv)
errors++;

rv=test_book_import_transactions();
if (rv)
errors++;

rv=test_book_import_transactions();
if (rv)
errors++;

rv=test_book_import_transfers();
if (rv)
errors++;

rv=test_book_dump_statements();
if (rv)
errors++;

rv=test_book_dump_transfers();
if (rv)
errors++;

rv=test_book_recon_transfers();
if (rv)
errors++;

rv=test_book_dump_statements();
if (rv)
errors++;

rv=test_book_dump_transfers();
if (rv)
errors++;

if (errors)
return 2;

return 0;
}




int main(int argc, char **argv) {
int rv;
const char *s;

rv=GWEN_Init();
if (rv) {
DBG_ERROR_ERR(0, rv);
return rv;
}

if (!GWEN_Logger_IsOpen(AE_LOGDOMAIN)) {
GWEN_Logger_Open(AE_LOGDOMAIN,
"aqfinance", 0,
GWEN_LoggerType_Console,
GWEN_LoggerFacility_User);
}

s=getenv("AE_LOGLEVEL");
if (s && *s) {
GWEN_LOGGER_LEVEL ll;

ll=GWEN_Logger_Name2Level(s);
GWEN_Logger_SetLevel(AE_LOGDOMAIN, ll);
}
else
GWEN_Logger_SetLevel(AE_LOGDOMAIN, GWEN_LoggerLevel_Notice);

return test();
}

(6-6/6)