inital checkin of unimrcp svn revision 985 from http://unimrcp.googlecode.com/svn/trunk/

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13790 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris committed 2009-06-16 22:31:19 +00:00
1 parent ec90221783
commit da925bddf8
349 files changed
+47866

No files matched your search

+11
View File
@@ -0,0 +1,11 @@
MAINTAINERCLEANFILES = Makefile.in
INCLUDES = -I$(top_srcdir)/libs/apr-toolkit/include \
$(UNIMRCP_APR_INCLUDES) $(UNIMRCP_APU_INCLUDES)
noinst_PROGRAMS = apttest
apttest_LDADD = $(top_builddir)/libs/apr-toolkit/libaprtoolkit.la \
$(UNIMRCP_APR_LIBS) $(UNIMRCP_APU_LIBS)
apttest_SOURCES = src/main.c \
src/task_suite.c \
src/consumer_task_suite.c
+171
View File
@@ -0,0 +1,171 @@
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="apttest"
ProjectGUID="{429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}"
RootNamespace="apttest"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
ConfigurationType="1"
InheritedPropertySheets="$(SolutionDir)build\vsprops\unidebug.vsprops;$(SolutionDir)build\vsprops\apt.vsprops"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="aprtoolkit.lib libaprutil-1.lib libapr-1.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
ConfigurationType="1"
InheritedPropertySheets="$(SolutionDir)build\vsprops\unirelease.vsprops;$(SolutionDir)build\vsprops\apt.vsprops"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="aprtoolkit.lib libaprutil-1.lib libapr-1.lib"
LinkTimeCodeGeneration="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="src"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\src\consumer_task_suite.c"
>
</File>
<File
RelativePath=".\src\main.c"
>
</File>
<File
RelativePath=".\src\task_suite.c"
>
</File>
</Filter>
<Filter
Name="include"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
@@ -0,0 +1,100 @@
/*
* Copyright 2008 Arsen Chaloyan
*
* 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.
*/
#include <apr_time.h>
#include "apt_test_suite.h"
#include "apt_consumer_task.h"
#include "apt_log.h"
typedef struct {
apr_time_t timestamp;
int number;
} sample_msg_data_t;
static void task_on_start_complete(apt_task_t *task)
{
apt_log(APT_LOG_MARK,APT_PRIO_INFO,"On Task Start");
}
static void task_on_terminate_complete(apt_task_t *task)
{
apt_log(APT_LOG_MARK,APT_PRIO_INFO,"On Task Terminate");
}
static apt_bool_t task_msg_process(apt_task_t *task, apt_task_msg_t *msg)
{
sample_msg_data_t *data = (sample_msg_data_t*)msg->data;
apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Process Message [%d]",data->number);
return TRUE;
}
static apt_bool_t consumer_task_test_run(apt_test_suite_t *suite, int argc, const char * const *argv)
{
apt_consumer_task_t *consumer_task;
apt_task_t *task;
apt_task_vtable_t *vtable;
apt_task_msg_pool_t *msg_pool;
apt_task_msg_t *msg;
sample_msg_data_t *data;
int i;
msg_pool = apt_task_msg_pool_create_dynamic(sizeof(sample_msg_data_t),suite->pool);
apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create Consumer Task");
consumer_task = apt_consumer_task_create(NULL,msg_pool,suite->pool);
if(!consumer_task) {
apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Consumer Task");
return FALSE;
}
task = apt_consumer_task_base_get(consumer_task);
vtable = apt_task_vtable_get(task);
if(vtable) {
vtable->process_msg = task_msg_process;
vtable->on_start_complete = task_on_start_complete;
vtable->on_terminate_complete = task_on_terminate_complete;
}
apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Start Task");
if(apt_task_start(task) == FALSE) {
apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Start Task");
apt_task_destroy(task);
return FALSE;
}
for(i=0; i<10; i++) {
msg = apt_task_msg_acquire(msg_pool);
msg->type = TASK_MSG_USER;
data = (sample_msg_data_t*) msg->data;
data->number = i;
data->timestamp = apr_time_now();
apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Signal Message [%d]",data->number);
apt_task_msg_signal(task,msg);
}
apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Terminate Task [wait till complete]");
apt_task_terminate(task,TRUE);
apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy Task");
apt_task_destroy(task);
return TRUE;
}
apt_test_suite_t* consumer_task_test_suite_create(apr_pool_t *pool)
{
apt_test_suite_t *suite = apt_test_suite_create(pool,"consumer",NULL,consumer_task_test_run);
return suite;
}
+54
View File
@@ -0,0 +1,54 @@
/*
* Copyright 2008 Arsen Chaloyan
*
* 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.
*/
#include "apt_test_suite.h"
#include "apt_log.h"
apt_test_suite_t* task_test_suite_create(apr_pool_t *pool);
apt_test_suite_t* consumer_task_test_suite_create(apr_pool_t *pool);
int main(int argc, const char * const *argv)
{
apt_test_framework_t *test_framework;
apt_test_suite_t *test_suite;
apr_pool_t *pool;
/* one time apr global initialization */
if(apr_initialize() != APR_SUCCESS) {
return 0;
}
/* create test framework */
test_framework = apt_test_framework_create();
pool = apt_test_framework_pool_get(test_framework);
/* create test suites and add them to test framework */
test_suite = task_test_suite_create(pool);
apt_test_framework_suite_add(test_framework,test_suite);
test_suite = consumer_task_test_suite_create(pool);
apt_test_framework_suite_add(test_framework,test_suite);
/* run tests */
apt_test_framework_run(test_framework,argc,argv);
/* destroy test framework */
apt_test_framework_destroy(test_framework);
/* final apr global termination */
apr_terminate();
return 0;
}
@@ -0,0 +1,62 @@
/*
* Copyright 2008 Arsen Chaloyan
*
* 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.
*/
#include "apt_test_suite.h"
#include "apt_task.h"
#include "apt_log.h"
static apt_bool_t task_main(apt_task_t *task)
{
apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Do the Job");
apt_task_delay(3000);
return TRUE;
}
static apt_bool_t task_test_run(apt_test_suite_t *suite, int argc, const char * const *argv)
{
apt_task_t *task;
apt_task_vtable_t *vtable;
apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create Task");
task = apt_task_create(NULL,NULL,suite->pool);
if(!task) {
apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Task");
return FALSE;
}
vtable = apt_task_vtable_get(task);
if(vtable) {
vtable->run = task_main;
}
apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Start Task");
if(apt_task_start(task) == FALSE) {
apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Start Task");
apt_task_destroy(task);
return FALSE;
}
apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Wait for Task to Complete");
apt_task_wait_till_complete(task);
apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy Task");
apt_task_destroy(task);
return TRUE;
}
apt_test_suite_t* task_test_suite_create(apr_pool_t *pool)
{
apt_test_suite_t *suite = apt_test_suite_create(pool,"task",NULL,task_test_run);
return suite;
}