Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
trackrdrd
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
trackrdrd
Commits
3da6fdab
Commit
3da6fdab
authored
May 16, 2014
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
trackrdrd: added unit tests for the ActiveMQ implementation of MQ
parent
c6c0f79d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
206 additions
and
1 deletion
+206
-1
Makefile.am
trackrdrd/Makefile.am
+1
-1
configure.ac
trackrdrd/configure.ac
+1
-0
Makefile.am
trackrdrd/src/mq/activemq/test/Makefile.am
+20
-0
test_activemq.c
trackrdrd/src/mq/activemq/test/test_activemq.c
+184
-0
No files found.
trackrdrd/Makefile.am
View file @
3da6fdab
ACLOCAL_AMFLAGS
=
-I
m4
SUBDIRS
=
src src/test src/mq/activemq
SUBDIRS
=
src src/test src/mq/activemq
src/mq/activemq/test
if
HAVE_RST2MAN
dist_man_MANS
=
trackrdrd.3
...
...
trackrdrd/configure.ac
View file @
3da6fdab
...
...
@@ -144,5 +144,6 @@ AC_CONFIG_FILES([
src/Makefile
src/test/Makefile
src/mq/activemq/Makefile
src/mq/activemq/test/Makefile
])
AC_OUTPUT
trackrdrd/src/mq/activemq/test/Makefile.am
0 → 100644
View file @
3da6fdab
INCLUDES
=
-I
$(VARNISHSRC)
/include
-I
$(VARNISHSRC)
-I
$(top_srcdir)
/include
TESTS
=
test_activemq
check_PROGRAMS
=
test_activemq
test_activemq_SOURCES
=
\
../../minunit.h
\
../../../../include/mq.h
\
test_activemq.c
test_activemq_LDADD
=
\
../amq_connection.
$(OBJEXT)
\
../amq.
$(OBJEXT)
\
../config_common.
$(OBJEXT)
\
../mq.
$(OBJEXT)
\
${
PTHREAD_LIBS
}
\
@AMQ_LIBS@
\
@APR_LIBS@
\
@APU_LIBS@
trackrdrd/src/mq/activemq/test/test_activemq.c
0 → 100644
View file @
3da6fdab
/*-
* Copyright (c) 2012-2014 UPLEX Nils Goroll Systemoptimierung
* Copyright (c) 2012-2014 Otto Gmbh & Co KG
* All rights reserved
* Use only with permission
*
* Author: Geoffrey Simmons <geoffrey.simmons@uplex.de>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
#include <string.h>
#include "mq.h"
#include "../../../test/minunit.h"
/* Automake exit code for "skipped" in make check */
#define EXIT_SKIPPED 77
#define AMQ_CONFIG "../../../test/activemq.conf"
#define NWORKERS 1
int
tests_run
=
0
;
void
*
worker
;
/* N.B.: Always run the tests in this order */
static
char
*
test_global_init
(
void
)
{
const
char
*
err
;
printf
(
"... testing ActiveMQ global initialization
\n
"
);
err
=
MQ_GlobalInit
(
NWORKERS
,
AMQ_CONFIG
);
VMASSERT
(
err
==
NULL
,
"MQ_GlobalInit: %s"
,
err
);
return
NULL
;
}
static
char
*
test_init_connection
(
void
)
{
const
char
*
err
;
printf
(
"... testing ActiveMQ connection initialization
\n
"
);
err
=
MQ_InitConnections
();
if
(
err
!=
NULL
&&
strstr
(
err
,
"Connection refused"
)
!=
NULL
)
{
printf
(
"Connection refused, ActiveMQ assumed not running
\n
"
);
exit
(
EXIT_SKIPPED
);
}
VMASSERT
(
err
==
NULL
,
"MQ_InitConnections: %s"
,
err
);
return
NULL
;
}
static
const
char
*
test_worker_init
(
void
)
{
const
char
*
err
;
printf
(
"... testing ActiveMQ worker init
\n
"
);
err
=
MQ_WorkerInit
(
&
worker
);
VMASSERT
(
err
==
NULL
,
"MQ_WorkerInit: %s"
,
err
);
MASSERT0
(
worker
!=
NULL
,
"Worker is NULL after MQ_WorkerInit"
);
return
NULL
;
}
static
const
char
*
test_version
(
void
)
{
const
char
*
err
;
char
version
[
BUFSIZ
];
printf
(
"... testing ActiveMQ version info
\n
"
);
MASSERT0
(
worker
!=
NULL
,
"MQ_Version: worker is NULL before call"
);
err
=
MQ_Version
(
worker
,
version
);
VMASSERT
(
err
==
NULL
,
"MQ_Version: %s"
,
err
);
MASSERT0
(
version
[
0
]
!=
'\0'
,
"MQ_Version: version is empty"
);
return
NULL
;
}
static
const
char
*
test_clientID
(
void
)
{
const
char
*
err
;
char
clientID
[
BUFSIZ
];
printf
(
"... testing ActiveMQ client ID info
\n
"
);
MASSERT0
(
worker
!=
NULL
,
"MQ_ClientID: worker is NULL before call"
);
err
=
MQ_ClientID
(
worker
,
clientID
);
VMASSERT
(
err
==
NULL
,
"MQ_ClientID: %s"
,
err
);
MASSERT0
(
clientID
[
0
]
!=
'\0'
,
"MQ_ClientID: client ID is empty"
);
return
NULL
;
}
static
const
char
*
test_send
(
void
)
{
const
char
*
err
;
printf
(
"... testing ActiveMQ message send
\n
"
);
MASSERT0
(
worker
!=
NULL
,
"MQ_Send: worker is NULL before call"
);
err
=
MQ_Send
(
worker
,
"foo bar baz quux"
,
16
);
VMASSERT
(
err
==
NULL
,
"MQ_Send: %s"
,
err
);
return
NULL
;
}
static
const
char
*
test_worker_shutdown
(
void
)
{
const
char
*
err
;
printf
(
"... testing ActiveMQ worker shutdown
\n
"
);
MASSERT0
(
worker
!=
NULL
,
"MQ_Send: worker is NULL before call"
);
err
=
MQ_WorkerShutdown
(
&
worker
);
VMASSERT
(
err
==
NULL
,
"MQ_WorkerShutdown: %s"
,
err
);
MASSERT0
(
worker
==
NULL
,
"Worker not NULL after shutdown"
);
err
=
MQ_Send
(
worker
,
"foo bar baz quux"
,
16
);
MASSERT0
(
err
!=
NULL
,
"No failure on MQ_Send after worker shutdown"
);
return
NULL
;
}
static
const
char
*
test_global_shutdown
(
void
)
{
const
char
*
err
;
printf
(
"... testing ActiveMQ global shutdown
\n
"
);
err
=
MQ_GlobalShutdown
();
VMASSERT
(
err
==
NULL
,
"MQ_GlobalShutdown: %s"
,
err
);
return
NULL
;
}
static
const
char
*
all_tests
(
void
)
{
mu_run_test
(
test_global_init
);
mu_run_test
(
test_init_connection
);
mu_run_test
(
test_worker_init
);
mu_run_test
(
test_version
);
mu_run_test
(
test_clientID
);
mu_run_test
(
test_send
);
mu_run_test
(
test_worker_shutdown
);
mu_run_test
(
test_global_shutdown
);
return
NULL
;
}
TEST_RUNNER
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment