OSDN Git Service

virtualservice試験コード更新
authorshoji <shoji@1ed66053-1c2d-0410-8867-f7571e6e31d3>
Fri, 18 Dec 2009 02:50:23 +0000 (02:50 +0000)
committershoji <shoji@1ed66053-1c2d-0410-8867-f7571e6e31d3>
Fri, 18 Dec 2009 02:50:23 +0000 (02:50 +0000)
git-svn-id: http://10.144.169.20/repos/um/branches/l7vsd-3.x-ramiel@9248 1ed66053-1c2d-0410-8867-f7571e6e31d3

23 files changed:
l7vsd/unit_tests/virtualservice_test/Makefile [new file with mode: 0644]
l7vsd/unit_tests/virtualservice_test/parameter_stub/Makefile [new file with mode: 0644]
l7vsd/unit_tests/virtualservice_test/parameter_stub/error_code.h [new file with mode: 0644]
l7vsd/unit_tests/virtualservice_test/parameter_stub/logger_enum.h [new file with mode: 0644]
l7vsd/unit_tests/virtualservice_test/parameter_stub/parameter.cpp [new file with mode: 0644]
l7vsd/unit_tests/virtualservice_test/parameter_stub/parameter.h [new file with mode: 0644]
l7vsd/unit_tests/virtualservice_test/parameter_stub/parameter_impl.cpp [new file with mode: 0644]
l7vsd/unit_tests/virtualservice_test/parameter_stub/parameter_impl.h [new file with mode: 0644]
l7vsd/unit_tests/virtualservice_test/protocol_module_test1.h [new file with mode: 0644]
l7vsd/unit_tests/virtualservice_test/schedule_module_test1.h [new file with mode: 0644]
l7vsd/unit_tests/virtualservice_test/sslfiles/ssl_conf.cf [new file with mode: 0644]
l7vsd/unit_tests/virtualservice_test/stub.cpp [new file with mode: 0644]
l7vsd/unit_tests/virtualservice_test/stub.h [new file with mode: 0644]
l7vsd/unit_tests/virtualservice_test/virtualservice.cpp [new file with mode: 0644]
l7vsd/unit_tests/virtualservice_test/virtualservice_tcp.cpp [new file with mode: 0644]
l7vsd/unit_tests/virtualservice_test/virtualservice_udp.cpp [new file with mode: 0644]
l7vsd/unit_tests/virtualservice_test/vs_base_test.cpp [new file with mode: 0644]
l7vsd/unit_tests/virtualservice_test/vs_tcp.h [new file with mode: 0644]
l7vsd/unit_tests/virtualservice_test/vs_tcp_it_ut.cpp [new file with mode: 0644]
l7vsd/unit_tests/virtualservice_test/vs_tcp_test.cpp [new file with mode: 0644]
l7vsd/unit_tests/virtualservice_test/vs_tcp_thread_test.cpp [new file with mode: 0644]
l7vsd/unit_tests/virtualservice_test/vs_tcp_thread_test2.cpp [new file with mode: 0644]
l7vsd/unit_tests/virtualservice_test/vs_test.h [new file with mode: 0644]

diff --git a/l7vsd/unit_tests/virtualservice_test/Makefile b/l7vsd/unit_tests/virtualservice_test/Makefile
new file mode 100644 (file)
index 0000000..d955566
--- /dev/null
@@ -0,0 +1,142 @@
+#
+#
+#      Makefile for module_control unit test frameworks.
+#
+#
+TARGET         = vs_base_ut vs_tcp_ut vs_tcp_thread_ut vs_tcp_thread_ut2 vs_tcp_it
+#TARGET                = vs_tcp_ut
+CPP                    = g++
+CPPFLAGS       = -O0 -g -Wall -Werror -pthread -D__SNMPBRIDGE_H__ -DMAX_BUFFER_SIZE=65535 -DDEBUG
+# CPPFLAGS     = -O2 -Wall -Werror -pthread -DMAX_BUFFER_SIZE=65535 -DDEBUG
+
+PARAMETERDIR    = ./parameter_stub
+
+INCLUDES       =               \
+                               -I./parameter_stub \
+                               -I./ \
+                               -I../../include \
+                               -I../../src \
+                               -I/usr/include
+LIBS           =               -lboost_system-gcc41-mt \
+                               -lboost_thread-gcc41-mt \
+                               -lboost_unit_test_framework-gcc41-mt \
+                               -lboost_serialization-gcc41-mt \
+                               -llog4cxx \
+                                -lparameter
+
+LDFLAGS                = -lrt -ldl -lssl -L$(PARAMETERDIR)
+
+LOGGER_PROCESS = -DLOGGER_PROCESS_VSD
+
+
+
+BASESRCS               =       \
+                               stub.cpp \
+                               ../../src/logger_implement_access.cpp \
+                                ../../src/logger_logrotate_utility.cpp \
+                                ../../src/logger_access_manager.cpp \
+                                ../../src/strict_time_based_rolling_policy.cpp \
+                                ../../src/time_and_size_based_rolling_policy.cpp \
+                               ../../src/virtualservice_base.cpp \
+                               virtualservice_tcp.cpp \
+                               virtualservice_udp.cpp \
+                               virtualservice.cpp \
+                               vs_base_test.cpp
+
+
+
+
+TCPSRCS                =       \
+                               stub.cpp \
+                               ../../src/logger_implement_access.cpp \
+                                ../../src/logger_logrotate_utility.cpp \
+                                ../../src/logger_access_manager.cpp \
+                                ../../src/strict_time_based_rolling_policy.cpp \
+                                ../../src/time_and_size_based_rolling_policy.cpp \
+                               ../../src/virtualservice_base.cpp \
+                               ../../src/virtualservice_tcp.cpp \
+                               virtualservice_udp.cpp \
+                               virtualservice.cpp \
+                               vs_tcp_test.cpp
+
+
+
+TCPTSRCS               =       \
+                               stub.cpp \
+                               ../../src/logger_implement_access.cpp \
+                                ../../src/logger_logrotate_utility.cpp \
+                                ../../src/logger_access_manager.cpp \
+                                ../../src/strict_time_based_rolling_policy.cpp \
+                                ../../src/time_and_size_based_rolling_policy.cpp \
+                               ../../src/virtualservice_base.cpp \
+                               ../../src/virtualservice_tcp.cpp \
+                               virtualservice_udp.cpp \
+                               virtualservice.cpp \
+                               vs_tcp_thread_test.cpp
+
+
+TCPT2SRCS              =       \
+                               stub.cpp \
+                               ../../src/logger_implement_access.cpp \
+                                ../../src/logger_logrotate_utility.cpp \
+                                ../../src/logger_access_manager.cpp \
+                                ../../src/strict_time_based_rolling_policy.cpp \
+                                ../../src/time_and_size_based_rolling_policy.cpp \
+                               ../../src/virtualservice_base.cpp \
+                               ../../src/virtualservice_tcp.cpp \
+                               virtualservice_udp.cpp \
+                               virtualservice.cpp \
+                               vs_tcp_thread_test2.cpp
+
+
+ITSRCS         =       \
+                               stub.cpp \
+                               ../../src/logger_implement_access.cpp \
+                                ../../src/logger_logrotate_utility.cpp \
+                                ../../src/logger_access_manager.cpp \
+                                ../../src/strict_time_based_rolling_policy.cpp \
+                                ../../src/time_and_size_based_rolling_policy.cpp \
+                               ../../src/virtualservice_base.cpp \
+                               ../../src/virtualservice_tcp.cpp \
+                               virtualservice_udp.cpp \
+                               virtualservice.cpp \
+                               vs_tcp_it_ut.cpp
+
+.SUFFIX:       .cpp .o
+.cpp.o:
+               $(CPP) $(CPPFLAGS) $(INCLUDES) -c $< -o $@
+
+BASEOBJS       = $(BASESRCS:.cpp=.o)
+
+TCPOBJS                = $(TCPSRCS:.cpp=.o)
+
+TPCTOBJS       = $(TCPTSRCS:.cpp=.o)
+
+TPCT2OBJS      = $(TCPT2SRCS:.cpp=.o)
+
+ITOBJS         = $(ITSRCS:.cpp=.o)
+
+all:   $(TARGET)
+
+vs_base_ut:    $(BASEOBJS)
+       $(CPP) $(INCLUDES) -o vs_base_ut $(BASEOBJS) $(LDFLAGS) $(LIBS)
+
+vs_tcp_ut:     $(TCPOBJS)
+       $(CPP) $(INCLUDES) -o vs_tcp_ut $(TCPOBJS) $(LDFLAGS) $(LIBS)
+
+vs_tcp_thread_ut: $(TPCTOBJS)
+       $(CPP) $(INCLUDES) -o vs_tcp_thread_ut $(TPCTOBJS) $(LDFLAGS) $(LIBS)
+
+vs_tcp_thread_ut2: $(TPCT2OBJS)
+       $(CPP) $(INCLUDES) -o vs_tcp_thread_ut2 $(TPCT2OBJS) $(LDFLAGS) $(LIBS)
+
+vs_tcp_it: $(ITOBJS)
+       $(CPP) $(INCLUDES) -o vs_tcp_it $(ITOBJS) $(LDFLAGS) $(LIBS)
+
+
+# $(TARGET):   $(OBJS)
+#      $(CPP) $(INCLUDES) -o $@ $(OBJS) $(LIBS)
+
+clean:
+       rm -f $(TARGET) $(BASEOBJS) $(TCPOBJS) $(TPCTOBJS) $(TPCT2OBJS) $(ITOBJS)
+
diff --git a/l7vsd/unit_tests/virtualservice_test/parameter_stub/Makefile b/l7vsd/unit_tests/virtualservice_test/parameter_stub/Makefile
new file mode 100644 (file)
index 0000000..680f21b
--- /dev/null
@@ -0,0 +1,31 @@
+TARGET = libparameter.a
+INCDIR = -I. -I../../../include -I../../../src
+CC     = g++
+CFLAGS = -O0 -fpic -g -Wall -Werror -pthread $(INCDIR)
+LD     = g++
+LIBS   = -L/usr/lib64
+LDFLAGS        = -DPARAMETER_FILE="/home/tuka/l7vsd-3.x-ramiel/l7vsd/unit_tests/l7vs_logger/l7vs.cf"
+
+SRCS   = parameter_impl.cpp \
+         parameter.cpp 
+#SRCS  = parameter_impl.cpp
+
+OBJS   = $(SRCS:.cpp=.o)
+
+.SUFFIXES: .cpp .o
+.cpp.o:
+       $(CC) $(CFLAGS) -c $< -o $@
+
+all:   $(TARGET)
+
+parameter_impl.o:parameter_impl.cpp
+       $(CC) $(CFLAGS) -c $< -o $@
+
+parameter.o:parameter.cpp
+       $(CC) $(CFLAGS) -o $@ -c $<
+
+clean:
+       rm -f $(TARGET) $(OBJS)
+
+$(TARGET): $(OBJS)
+       ar rcs $@ $^
diff --git a/l7vsd/unit_tests/virtualservice_test/parameter_stub/error_code.h b/l7vsd/unit_tests/virtualservice_test/parameter_stub/error_code.h
new file mode 100644 (file)
index 0000000..bad5006
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef        ERROR_CODE_H
+#define        ERROR_CODE_H
+
+#include <string>
+
+namespace l7vs{
+//! @class     error_code
+//!    @brief  getValue error
+//! @brief     this class is POD
+class  error_code{
+protected:
+       bool            flag;   //!<    errorcode flag
+       std::string     msg;    //!<    errorcode message
+public:
+       error_code() : flag(false){}    //!< constractor
+       //! setter constractor
+       //! @param[in]  flags
+       //! @param[in]  error message
+       error_code( const bool inflg, const std::string& instr ){
+               flag = inflg;
+               msg = instr;
+       }
+       bool    operator==( const bool in )const { return ( flag == in ); } //!< operator== orverload
+       bool    operator!=( const bool in )const { return ( flag != in ); } //!< operator!= orverload
+       bool    operator!() const { return !flag; } //!< operator! orverload
+       typedef void (*unspecified_bool_type)();        //!< if return function
+       static void unspecified_bool_true() {}          //!< if true orverload function
+       operator unspecified_bool_type() const { return flag == 0 ? 0 : unspecified_bool_true; } //!< if() orverload
+       const std::string&      get_message() const { return msg; }             //!< message getter
+       //! error setter
+       //! @param[in]  flags
+       //! @param[in]  error message
+       void    setter( const bool flg, const std::string& instr ){
+               flag = flg;
+               msg = instr;
+       }
+};
+
+}
+
+#endif // ERROR_CODE_H
+
diff --git a/l7vsd/unit_tests/virtualservice_test/parameter_stub/logger_enum.h b/l7vsd/unit_tests/virtualservice_test/parameter_stub/logger_enum.h
new file mode 100644 (file)
index 0000000..b5735ef
--- /dev/null
@@ -0,0 +1,137 @@
+/*!
+ * @file  logger_enum.h
+ * @brief logger module constants enumeration.
+ *
+ * L7VSD: Linux Virtual Server for Layer7 Load Balancing
+ * Copyright (C) 2009  NTT COMWARE Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *      
+ **********************************************************************/
+
+#ifndef LOGGER_ENUM_H
+#define LOGGER_ENUM_H
+
+#include <list>
+#include <boost/function.hpp>
+#include <log4cxx/level.h>
+
+namespace l7vs{
+
+//!    @enum   LOG_LV_TAG
+//!    @brief  LogLevel enumeration.
+enum LOG_LEVEL_TAG     {
+       LOG_LV_NONE = 0,        //!< loglevel is none
+       LOG_LV_DEBUG,           //!< loglevel is debug
+       LOG_LV_INFO,            //!< loglevel is info
+       LOG_LV_WARN,            //!< loglevel is warn
+       LOG_LV_ERROR,           //!< loglevel is error
+       LOG_LV_FATAL            //!< loglevel is fatal
+};
+
+//! loglevel enum incliment function
+//! @param[in] logleveltag refarence
+//!    @return         logleveltag reference
+inline LOG_LEVEL_TAG& operator++(LOG_LEVEL_TAG& level) {
+       level = static_cast<LOG_LEVEL_TAG>(level + 1);
+       return level;
+}
+
+//!    @enum   LOG_CATEGORY_TAG
+//!    @brief  Category enumeration.
+//!    @brief  LOG_CAT_SSLPROXY_LOGGER should be first for logger log.
+enum LOG_CATEGORY_TAG{
+       LOG_CAT_NONE = 0,                                               //!< logcategory is none
+       LOG_CAT_L7VSD_NETWORK,                                  //!< logcategory is network
+       LOG_CAT_L7VSD_NETWORK_QOS,                              //!< logcategory is QoS
+       LOG_CAT_L7VSD_NETWORK_BANDWIDTH,                //!< logcategory is bps
+       LOG_CAT_L7VSD_NETWORK_NUM_CONNECTION,   //!< logcategory is connection count
+       LOG_CAT_L7VSD_NETWORK_ACCESS,                   //!< logcategory is access log
+       LOG_CAT_L7VSD_MAINTHREAD,                               //!< logcategory is mainthread
+       LOG_CAT_L7VSD_VIRTUALSERVICE,                   //!< logcategory is virtualservice
+       LOG_CAT_L7VSD_VIRTUALSERVICE_THREAD,    //!< logcategory is virtualservice thread
+       LOG_CAT_L7VSD_SESSION,                                  //!< logcategory is session
+       LOG_CAT_L7VSD_SESSION_THREAD,                   //!< logcategory is session thread
+       LOG_CAT_L7VSD_REALSERVER,                               //!< logcategory is realserver
+       LOG_CAT_L7VSD_SORRYSERVER,                              //!< logcategory is sollyserver
+       LOG_CAT_L7VSD_MODULE,                                   //!< logcategory is module controler
+       LOG_CAT_L7VSD_REPLICATION,                              //!< logcategory is replication
+       LOG_CAT_L7VSD_REPLICATION_SENDTHREAD,   //!< logcategory is replication send thread
+       LOG_CAT_L7VSD_PARAMETER,                                //!< logcategory is parameter
+       LOG_CAT_L7VSD_LOGGER,                                   //!< logcategory is logger
+       LOG_CAT_L7VSD_COMMAND,                                  //!< logcategory is command reciver
+       LOG_CAT_L7VSD_START_STOP,                               //!< logcategory is main function used
+       LOG_CAT_L7VSD_SYSTEM,                                   //!< logcategory is systemcall other
+       LOG_CAT_L7VSD_SYSTEM_MEMORY,                    //!< logcategory is systemcall memory
+       LOG_CAT_L7VSD_SYSTEM_ENDPOINT,                  //!< logcategory is systemcall socket 
+       LOG_CAT_L7VSD_SYSTEM_SIGNAL,                    //!< logcategory is systemcall signal
+       LOG_CAT_L7VSD_SYSTEM_ENVIRONMENT,               //!< logcategory is systemcall env
+       LOG_CAT_L7VSD_SNMPBRIDGE,                               //!< logcategory is snmp_bridge
+
+       LOG_CAT_PROTOCOL,                                               //!< logcategory is protocol.
+       LOG_CAT_SCHEDULE,                                               //!< logcategory is schedule
+
+       LOG_CAT_L7VSADM_PARSE,                                  //!< logcategory is parse
+       LOG_CAT_L7VSADM_OPERATE,                                //!< logcategory is operate
+       LOG_CAT_L7VSADM_CONFIG_RESULT,                  //!< logcategory is configure
+       LOG_CAT_L7VSADM_COMMON,                                 //!< logcategory is other
+       LOG_CAT_L7VSADM_LOGGER,                                 //!< logcategory is logger
+       LOG_CAT_L7VSADM_PARAMETER,                              //!< logcategory is parameter
+       LOG_CAT_L7VSADM_MODULE,                                 //!< logcategory is module control
+
+       LOG_CAT_SNMPAGENT_START_STOP,                   //!< logcategory is snmpagent main
+       LOG_CAT_SNMPAGENT_MANAGER_RECEIVE,              //!< logcategory is manager send
+       LOG_CAT_SNMPAGENT_MANAGER_SEND,                 //!< logcategory is manager recv
+       LOG_CAT_SNMPAGENT_L7VSD_RECEIVE,                //!< logcategory is snmpbrigde recv
+       LOG_CAT_SNMPAGENT_L7VSD_SEND,                   //!< logcategory is snmpbrigre send
+       LOG_CAT_SNMPAGENT_LOGGER,                               //!< logcategory is manager logger
+       LOG_CAT_SNMPAGENT_PARAMETER,                    //!< logcategory is manager parameter
+       LOG_CAT_SNMPAGENT_SYSTEM,                               //!< logcategory is snmpagent systemcall other
+       LOG_CAT_SNMPAGENT_SYSTEM_MEMORY,                //!< logcategory is snmpagent systemcall memory
+       LOG_CAT_SNMPAGENT_SYSTEM_ENDPOINT,              //!< logcategory is snmpagent systemcall socket 
+       LOG_CAT_SNMPAGENT_SYSTEM_SIGNAL,                //!< logcategory is snmpagent systemcall signal
+       LOG_CAT_SNMPAGENT_SYSTEM_ENVIRONMENT,   //!< logcategory is snmpagent systemcall env
+
+       LOG_CAT_SSLPROXY_LOGGER,                                //!< logcategory is snmpproxy logger
+       LOG_CAT_SSLPROXY_PARAMETER,                             //!< logcategory is snmpproxy parameter
+       LOG_CAT_SSLPROXY_COMMON,                                //!< logcategory is snmpproxy common
+       LOG_CAT_SSLPROXY_SERVER,                                //!< logcategory is snmpproxy server
+       LOG_CAT_SSLPROXY_SESSION,                               //!< logcategory is snmpproxy session
+       LOG_CAT_SSLPROXY_CONNECTION,                    //!< logcategory is snmpproxy connection
+       LOG_CAT_END,                                                            //!< end of logcategory
+};
+
+
+//! logcategory enum incliment function
+//! @param[in] logcategorytag refarence
+//!    @return         logcategorytag reference
+inline LOG_CATEGORY_TAG& operator++(LOG_CATEGORY_TAG& cat) {
+       cat = static_cast<LOG_CATEGORY_TAG>(cat + 1);
+       return cat;
+}
+
+//! typedef category level pair list
+typedef        std::list< std::pair< LOG_CATEGORY_TAG, LOG_LEVEL_TAG > >
+       category_level_list_type;
+
+//! typedef snmp send trap func type
+typedef boost::function<void( const std::string& )>
+       snmpSendtrapFuncType;
+
+
+} //namespace l7vs
+#endif //__LOGGER_ENUM_H__
+
diff --git a/l7vsd/unit_tests/virtualservice_test/parameter_stub/parameter.cpp b/l7vsd/unit_tests/virtualservice_test/parameter_stub/parameter.cpp
new file mode 100644 (file)
index 0000000..b845fd9
--- /dev/null
@@ -0,0 +1,147 @@
+#include "parameter_enum.h"
+#include "./parameter.h"
+#include "./parameter_impl.h"
+#include "utility.h"
+#include "logger.h"
+
+#if !defined(LOGGER_PROCESS_VSD) && !defined(LOGGER_PROCESS_ADM) && !defined(LOGGER_PROCESS_SNM)
+#define LOGGER_PROCESS_VSD
+#endif
+
+#ifdef LOGGER_PROCESS_SNM
+l7vs::LOG_CATEGORY_TAG param_cat = l7vs::LOG_CAT_SNMPAGENT_PARAMETER;
+#elif  LOGGER_PROCESS_ADM
+l7vs::LOG_CATEGORY_TAG param_cat = l7vs::LOG_CAT_L7VSADM_PARAMETER;
+#else
+l7vs::LOG_CATEGORY_TAG param_cat = l7vs::LOG_CAT_L7VSD_PARAMETER;
+#endif
+
+//!
+//! Constructor of Parameter class
+//!
+l7vs::Parameter::Parameter(){
+    if( !ParameterImpl::get_instance().init() ){
+        Logger::putLogFatal( param_cat, 1, "Parameter initialize failure",
+                             __FILE__, __LINE__ );
+        switch( param_cat ){
+        case LOG_CAT_L7VSADM_PARAMETER:
+            Logger::putLogFatal( param_cat, 2,
+                             "param_cat=LOG_CAT_L7VSDADM_PARAMETER continue!",
+                             __FILE__, __LINE__ );
+            break;
+        default:
+            Logger::putLogFatal( param_cat, 3,
+                             "param_cat= not LOG_CAT_L7VSDADM_PARAMETER exit!",
+                             __FILE__, __LINE__ );
+            exit(1);
+        }
+    }
+}
+
+//!
+//! Destructor of Parameter class
+//!
+l7vs::Parameter::~Parameter(){
+}
+
+//! Initialize ParameterImpl class(file designation)
+//! @param[in]    COMPONENT TAG
+//! @param[in]    file name
+//! @return true  success
+//! @return false failer
+bool l7vs::Parameter::init( const PARAMETER_COMPONENT_TAG comp,
+                            const std::string& filename ){
+    ParameterImpl& impl = ParameterImpl::get_instance();
+    return impl.init( comp, filename );
+}
+
+//! read configuration file
+//! @param[in]   comp        section TAG
+//! @param[in]   file_name   configuration filename
+//! @return      true = success read file / false = failure read file
+bool l7vs::Parameter::read_file( const PARAMETER_COMPONENT_TAG comp,
+                                 const std::string& file_name ){
+    ParameterImpl& impl = ParameterImpl::get_instance();
+    return impl.read_file( comp, file_name );
+}
+
+//! get integer data.
+//! @param[in]  comp        section TAG
+//! @param[in]  key         key string
+//! @param[out] err         error_code
+//! @param[in]  file_name   configuration file name
+//! @return     value
+int l7vs::Parameter::get_int( const l7vs::PARAMETER_COMPONENT_TAG comp,
+                              const std::string& key,
+                              l7vs::error_code& err,
+                              const std::string& file_name ){
+    ParameterImpl& impl = ParameterImpl::get_instance();
+    return impl.get_int( comp, key, err, file_name );
+}
+
+//! get character data.
+//! @param[in]  comp        section TAG
+//! @param[in]  key         key string
+//! @param[out] err         error_code
+//! @param[in]  file_name   configuration file name
+//! @return     value
+std::string l7vs::Parameter::get_string(
+                                     const l7vs::PARAMETER_COMPONENT_TAG comp,
+                                     const std::string& key,
+                                     l7vs::error_code& err,
+                                     const std::string& file_name ){
+    ParameterImpl& impl = ParameterImpl::get_instance();
+    return impl.get_string( comp, key, err, file_name );
+}
+
+//! get character data.(multi)
+//! @param[in]    comp        section TAG
+//! @param[in]    key         key string
+//! @param[inout] retvec      string vector 
+//! @param[out]   err         error code
+//! @param[in]    file_name   configuration file name
+//! @return       void
+void l7vs::Parameter::get_multistring(
+                                     const l7vs::PARAMETER_COMPONENT_TAG comp,
+                                     const std::string& key,
+                                     std::vector<std::string>& retvec,
+                                     l7vs::error_code& err,
+                                     const std::string& file_name ){
+    ParameterImpl&    impl = ParameterImpl::get_instance();
+    return impl.get_multistring( comp, key, retvec, err, file_name );
+}
+
+
+
+void    l7vs::Parameter::setIntValue(const PARAMETER_COMPONENT_TAG comp, const std::string& key, const int value)
+{
+
+       ParameterImpl&  impl = ParameterImpl::get_instance();
+       return impl.setIntValue( comp, key, value );
+
+}
+
+void    l7vs::Parameter::setStringValue(const PARAMETER_COMPONENT_TAG comp, const std::string& key, const std::string& value)
+{
+        ParameterImpl&  impl = ParameterImpl::get_instance();
+        return impl.setStringValue( comp, key, value );
+
+}
+
+void    l7vs::Parameter::deleteIntValue(const PARAMETER_COMPONENT_TAG comp, const std::string& key)
+{
+        ParameterImpl&  impl = ParameterImpl::get_instance();
+        return impl.deleteIntValue( comp, key );
+
+}
+
+
+void    l7vs::Parameter::deleteStringValue(const PARAMETER_COMPONENT_TAG comp, const std::string& key)
+{
+        ParameterImpl&  impl = ParameterImpl::get_instance();
+
+        return impl.deleteStringValue( comp, key );
+}
+
+
+
diff --git a/l7vsd/unit_tests/virtualservice_test/parameter_stub/parameter.h b/l7vsd/unit_tests/virtualservice_test/parameter_stub/parameter.h
new file mode 100644 (file)
index 0000000..b7fa653
--- /dev/null
@@ -0,0 +1,97 @@
+#ifndef PARAMETER_H
+#define PARAMETER_H
+
+#include <iostream>
+#include <map>
+#include "parameter_enum.h"
+#include "./parameter_impl.h"
+#include "error_code.h"
+#include "logger_enum.h"
+#include "logger.h"
+
+//      publicメンバの「RetBool」「RetInt」「RetStr」は、デバッグ用に追加されたメンバです。
+//      l7vs::Parameter::getInstance().RetBool = true;
+//      l7vs::Parameter::getInstance().RetInt = 444;
+//      l7vs::Parameter::getInstance().RetStr = "test string";
+//      の様にすることで、任意の値を返すようになります。
+
+#ifndef PARAMETER_FILE
+#define PARAMETER_FILE "/etc/l7vs/l7vs.cf"
+#endif //PARAMETER_FILE
+
+
+namespace l7vs
+{
+       class ParameterImpl;
+       class Parameter
+       {
+public:
+    Parameter();                            //!< default constractor
+    ~Parameter();                           //!< default destractor
+
+    //! initialize(file designation)
+    //! @param[in]    component tag
+    //! @param[in]    file name
+    //! @return true success
+    //! @return false failer
+    bool init( const PARAMETER_COMPONENT_TAG, const std::string& );
+
+    //! reload file function
+    //! @param[in]    parameter conponent tag
+    //! @param[in]    configuration filename
+    //!                   default:PARAMETER_FILE
+    //! @return true  success file read
+    //! @return false failure file read
+    bool read_file(const PARAMETER_COMPONENT_TAG,
+                   const std::string& = PARAMETER_FILE );
+
+    //! parameter int value getter
+    //! @param[in]    parametercategory
+    //! @param[in]    parameter key
+    //! @param[out]   error code
+    //! @param[in]    configuration filename
+    //!                   default:PARAMETER_FILE
+    //! @return int value
+    int get_int(const PARAMETER_COMPONENT_TAG,
+                const std::string&,
+                error_code&,
+                const std::string& = PARAMETER_FILE );
+
+    //! parameter string value getter
+    //! @param[in]    parametercategory
+    //! @param[in]    parameter key
+    //! @param[out]   error code
+    //! @param[in]    configuration filename
+    //!                   default:PARAMETER_FILE
+    //! @return string value
+    std::string get_string(const PARAMETER_COMPONENT_TAG,
+                           const std::string&,
+                           error_code&,
+                           const std::string& = PARAMETER_FILE );
+
+    //! parameter multistring value getter
+    //! @param[in]    parametercategory
+    //! @param[in]    parameter key
+    //! @param[inout] string vector
+    //! @param[out]   error code
+    //! @param[in]    configuration filename
+    //!                   default:PARAMETER_FILE
+    //! @return string value
+    void get_multistring(const PARAMETER_COMPONENT_TAG,
+                         const std::string&,
+                         std::vector<std::string>&,
+                         error_code&,
+                         const std::string& = PARAMETER_FILE );
+
+
+       void    setIntValue(const PARAMETER_COMPONENT_TAG comp, const std::string& key, const int value);
+       void    setStringValue(const PARAMETER_COMPONENT_TAG comp, const std::string& key, const std::string& value);
+
+        void    deleteIntValue(const PARAMETER_COMPONENT_TAG comp, const std::string& key);
+        void    deleteStringValue(const PARAMETER_COMPONENT_TAG comp, const std::string& key);
+
+
+       };
+};
+       
+#endif //PARAMETER_H__
diff --git a/l7vsd/unit_tests/virtualservice_test/parameter_stub/parameter_impl.cpp b/l7vsd/unit_tests/virtualservice_test/parameter_stub/parameter_impl.cpp
new file mode 100644 (file)
index 0000000..f9d1381
--- /dev/null
@@ -0,0 +1,469 @@
+#include <vector>
+#include <fstream>
+#include <stdexcept>
+#include "./parameter_impl.h"
+#include "./logger_enum.h"
+#include "parameter_enum.h"
+#include "utility.h"
+#include "logger.h"
+
+//#include "lexical_cast.h"
+#include <boost/lexical_cast.hpp>
+#include <boost/algorithm/string.hpp>
+#include <boost/foreach.hpp>
+#include <boost/function.hpp>
+#include <boost/format.hpp>
+
+
+
+#define        LINE_LENGTH     4096
+
+
+#ifndef PARAMETER_FILE
+       #define PARAMETER_FILE "/etc/l7vs/l7vs.cf"
+#endif //PARAMETER_FILE
+
+#if !defined(LOGGER_PROCESS_VSD) && !defined(LOGGER_PROCESS_ADM) && !defined(LOGGER_PROCESS_SNM)
+       #define LOGGER_PROCESS_VSD
+#endif
+
+#ifdef  LOGGER_PROCESS_SNM
+       l7vs::LOG_CATEGORY_TAG logcat = l7vs::LOG_CAT_SNMPAGENT_PARAMETER;
+#elif   LOGGER_PROCESS_ADM
+       l7vs::LOG_CATEGORY_TAG logcat = l7vs::LOG_CAT_L7VSADM_PARAMETER;
+#else
+       l7vs::LOG_CATEGORY_TAG logcat = l7vs::LOG_CAT_L7VSD_PARAMETER;
+#endif
+
+#define    SESSION_POOL_NUM_PARAM    (256)
+
+static bool create_map_flag = false;
+
+//
+//! Initialize ParameterImpl class
+//! @return true    success
+//! @return false   failer
+bool l7vs::ParameterImpl::init(){
+
+    boost::mutex::scoped_lock lock( create_mutex );
+
+    if( create_map_flag ) return true;
+
+    tag_section_table_map.clear();
+    multistringMap.clear();
+    intMap.clear();
+    tag_section_table_map[PARAM_COMP_L7VSD]          = "l7vsd";
+    tag_section_table_map[PARAM_COMP_COMMAND]        = "command"; 
+    tag_section_table_map[PARAM_COMP_SESSION]        = "session";
+    tag_section_table_map[PARAM_COMP_VIRTUALSERVICE] = "virtualservice";
+    tag_section_table_map[PARAM_COMP_MODULE]         = "module";
+    tag_section_table_map[PARAM_COMP_REPLICATION]    = "replication";
+    tag_section_table_map[PARAM_COMP_LOGGER]         = "logger";
+    tag_section_table_map[PARAM_COMP_L7VSADM]        = "l7vsadm";
+    tag_section_table_map[PARAM_COMP_SNMPAGENT]      = "snmpagent";
+    tag_section_table_map[PARAM_COMP_SSL]            = "ssl";
+    create_map_flag = read_file( PARAM_COMP_ALL, PARAMETER_FILE );
+    return create_map_flag;
+}
+
+//! Initialize ParameterImpl class(file designation)
+//! @param[in]    COMPONENT TAG
+//! @param[in]    file name
+//! @return true  success
+//! @return false failer
+bool l7vs::ParameterImpl::init( const l7vs::PARAMETER_COMPONENT_TAG comp,
+                                const std::string& file_name ){
+
+    boost::mutex::scoped_lock lock( create_mutex );
+
+    if( !create_map_flag ){
+        // parameter_impl isn't initialized
+        Logger::putLogFatal( logcat, 4, "NOT INITIALIZED", __FILE__, __LINE__ );
+        return false;
+    }
+
+    // read target file
+    bool read_result = read_file( comp, file_name );
+
+    return read_result;
+}
+
+//! read config file
+//! @param[in]    COMPONENT TAG
+//! @param[in]    file name
+//! @return true read success
+//! @return false read false
+bool l7vs::ParameterImpl::read_file( const l7vs::PARAMETER_COMPONENT_TAG comp,
+                                     const std::string& file_name ){
+
+    typedef std::vector< std::string >               split_vector_type;
+    typedef std::pair< std::string, int >            int_pair_type;
+    typedef std::pair< std::string, std::string >    string_pair_type;
+
+    boost::mutex::scoped_lock lock( param_mutex );
+    std::string      line;
+    std::ifstream    ifs( file_name.c_str() );
+    multistring_map_type  multistring_map;
+    int_map_type     int_map;
+
+    if( !ifs ){
+        // don't open config file.
+        std::stringstream buf;
+        buf << "CONFIG FILE NOT OPEN : " << file_name;
+        Logger::putLogFatal( logcat, 5, buf.str() , __FILE__, __LINE__ );
+        return false;
+    }
+
+    std::string    section_string;
+    while( std::getline( ifs, line ) ){
+        // triming
+        boost::algorithm::trim( line );
+        // zero line skip
+        if( line.size() == 0 ) continue;
+        // comment line skip
+        if( line[0] == '#' ) continue;
+        // comment clear
+        std::string::size_type pos = line.find( '#' );
+        if( pos != std::string::npos ) line = line.substr( 0, pos );
+
+        split_vector_type split_vec;
+        boost::algorithm::split( split_vec,
+                                 line,
+                                 boost::algorithm::is_any_of( "=" ) );
+        // [section(split_vec[0])]
+        if( split_vec.size() == 1 ){
+            // get section_string
+            if( split_vec[0].at(0) == '[' &&
+                split_vec[0].at( split_vec[0].size()-1 ) == ']' ){
+                // erase [
+                section_string = 
+                             split_vec[0].substr( 1, split_vec[0].size() - 2 );
+            }
+            else{
+                boost::format formatter( "section tag false : %1%" );
+                formatter % split_vec[0];
+                Logger::putLogFatal( logcat, 6, formatter.str(),
+                                     __FILE__, __LINE__ );
+                return false;
+            }
+        }
+        // key(split_vec[0]) = value(split_vec[1])
+        else if( split_vec.size() == 2 ){
+            // non get section_string
+            if( section_string.size() == 0 ){
+                boost::format formatter(
+                    "don't match first section. key = %1%, value = %2%" );
+                formatter % split_vec[0] % split_vec[1];
+                Logger::putLogFatal( logcat, 7, formatter.str(),
+                                     __FILE__, __LINE__ );
+                return false;
+            }
+            // create section.key
+            boost::algorithm::trim( split_vec[0] );
+            boost::algorithm::trim( split_vec[1] );
+            std::string key = file_name + "#";
+            key += section_string;
+            key += ".";
+            key += split_vec[0];
+            // insert string value
+            if( split_vec[1].at(0) == '\"' &&
+                split_vec[1].at( split_vec[1].size()-1 ) == '\"' ){
+                // create string value
+                std::string strvalue =
+                               split_vec[1].substr( 1, split_vec[1].size()-2 );
+                // check same key
+                if( multistring_map.end() != multistring_map.find(key)){
+                    // Only SSL component can designate more than one value.
+                    // Other component overwrite tmp multimap
+
+                    // get compornent tag from section_string
+                    for( std::map<PARAMETER_COMPONENT_TAG, std::string>::iterator section_itr = tag_section_table_map.begin();
+                         section_itr != tag_section_table_map.end();
+                         ++section_itr ){
+                        if( section_itr->second == section_string &&
+                            section_itr->first != PARAM_COMP_SSL ){
+                            multistring_map.erase( key );
+                            break;
+                        }
+                    }
+                }
+                // tmp multimap insert
+                multistring_map.insert( string_pair_type( key, strvalue ) );
+            }
+            // insert int value
+            else{
+                try{
+                    // create int value
+                    int intvalue = boost::lexical_cast<int>( split_vec[1] );
+
+                    // check same key
+                    if( int_map.end() != int_map.find( key ) ){
+                        // Every component overwrite
+                        int_map.erase( key );
+                    }
+                    // tmp map insert
+                    std::pair< int_map_type::iterator, bool > ret =
+                        int_map.insert( int_pair_type( key, intvalue ) );
+                    // insert error
+                    if( !ret.second ){
+                        boost::format formatter(
+                   "section.key is duplicate. section.key = %1%, value = %2%" );
+                        formatter % key % intvalue;
+                        Logger::putLogError( logcat, 1, formatter.str(),
+                                             __FILE__, __LINE__ );
+                    }
+                }
+                // exception handing
+                catch( boost::bad_lexical_cast& cast ){
+                    boost::format formatter( "value is not numeric : %1%" );
+                    formatter % split_vec[1];
+                    Logger::putLogFatal( logcat, 8, formatter.str(),
+                                         __FILE__, __LINE__ );
+                }
+            }
+        }
+        // format error
+        else{
+            boost::format formatter( "line is not support line = %1%" );
+            formatter % line;
+            Logger::putLogError( logcat, 2, formatter.str(),
+                                 __FILE__, __LINE__ );
+        }
+    }
+
+    //convert temporaly map to global map.
+    if( comp == PARAM_COMP_ALL ){
+        intMap.clear();
+        // all tmp int map copy
+        BOOST_FOREACH( int_pair_type p, int_map ){
+            intMap.insert( p );
+        }
+        multistringMap.clear();
+        // all temp multistring map copy
+        BOOST_FOREACH( string_pair_type p, multistring_map ){
+            multistringMap.insert( p );
+        }
+    }
+    // comp error
+    else if( comp == PARAM_COMP_NOCAT ){
+        Logger::putLogError( logcat, 3,
+                             "parameter_component_none is not suport",
+                             __FILE__, __LINE__ );
+    }
+    // TAG designation
+    else{
+        // get section
+        std::map<PARAMETER_COMPONENT_TAG, std::string>::iterator section_itr =
+                                            tag_section_table_map.find( comp );
+        std::string section = section_itr->second;
+        // tmp int map copy
+        for( int_map_type::iterator itr = intMap.begin();
+             itr != intMap.end(); ++itr ){
+            split_vector_type file_vec;
+            boost::algorithm::split( file_vec, itr->first,
+                                     boost::algorithm::is_any_of( "#" ) );
+            split_vector_type split_vec;
+            boost::algorithm::split( split_vec, file_vec[1],
+                                     boost::algorithm::is_any_of( "." ) );
+            // target section
+            if( (file_vec[0] + split_vec[0]) == (file_name + section) ){
+                // erase section
+                intMap.erase( itr );
+                if( intMap.empty() ){
+                    break;
+                }
+            }
+        }
+        BOOST_FOREACH( int_pair_type p, int_map ){
+            split_vector_type file_vec;
+            boost::algorithm::split( file_vec, p.first,
+                                     boost::algorithm::is_any_of( "#" ) );
+            split_vector_type split_vec;
+            boost::algorithm::split( split_vec, file_vec[1],
+                                     boost::algorithm::is_any_of( "." ) );
+            // target section
+            if( split_vec[0] == section ){
+                // insert
+                std::pair<int_map_type::iterator, bool> ret = intMap.insert(p);
+                // insert error
+                if( !ret.second ){
+                    boost::format formatter(
+                        "not insert key = %1%, value = %2% " );
+                    formatter % p.first % p.second;
+                    Logger::putLogError( logcat, 4, formatter.str(),
+                                         __FILE__, __LINE__ );
+                }
+            }
+        }
+
+        // tmp multistring map copy
+        for( multistring_map_type::iterator itr = multistringMap.begin();
+             itr != multistringMap.end(); ++itr ){
+            split_vector_type file_vec;
+            boost::algorithm::split( file_vec, itr->first,
+                                     boost::algorithm::is_any_of( "#" ) );
+            split_vector_type split_vec;
+            boost::algorithm::split( split_vec, file_vec[1],
+                                     boost::algorithm::is_any_of( "." ) );
+            // target section
+            if( (file_vec[0] + split_vec[0]) == (file_name + section) ){
+                // erase section
+                multistringMap.erase( itr );
+                if( multistringMap.empty() )
+                {
+                    break;
+                }
+            }
+        }
+        BOOST_FOREACH( string_pair_type p, multistring_map ){
+            split_vector_type file_vec;
+            boost::algorithm::split( file_vec, p.first,
+                                     boost::algorithm::is_any_of( "#" ) );
+            split_vector_type split_vec;
+            boost::algorithm::split( split_vec, file_vec[1],
+                                     boost::algorithm::is_any_of( "." ) );
+            // target section
+            if( split_vec[0] == section ){
+                // insert
+                multistringMap.insert( p );
+            }
+        }
+    }
+    return true;
+}
+
+//! get a integer parameter
+//! @param[in]    comp          section TAG
+//! @param[in]    key           key string
+//! @param[out]   err           error_code
+//! @param[in]    file_name     configuration file name
+//! @return       integer value
+int l7vs::ParameterImpl::get_int( const l7vs::PARAMETER_COMPONENT_TAG comp,
+                                  const std::string& key,
+                                  l7vs::error_code& err,
+                                  const std::string& file_name ){
+
+                                    
+    if ( key == "session_thread_pool_size" ) {
+        // テスト用の値として、l7vs::virtualservice_base::SESSION_POOL_NUM_DEFAULTに設定
+        // されている値を返却するよう処理を修正する。
+        return(256);
+    }
+
+    boost::mutex::scoped_lock lock( param_mutex );
+
+    // error_code clear
+    err.setter(false, "");
+    // find section
+    std::map<PARAMETER_COMPONENT_TAG, std::string>::iterator
+        section_table_iterator = tag_section_table_map.find( comp );
+    // create search key
+    std::string search_key = file_name +"#";
+    search_key += section_table_iterator->second;
+    search_key += ".";
+    search_key += key;
+    int_map_type::iterator intmap_iterator = intMap.find( search_key );
+    if( intmap_iterator != intMap.end() ) {
+        return intmap_iterator->second;
+    } else {
+        err.setter( true, "don't find key" );
+    }
+    return 0;
+}
+
+//! get a string parameter
+//! @param[in]  comp        section TAG
+//! @param[in]  key         key string
+//! @param[out] err         error_code
+//! @param[in]  file_name   configuration file name
+//! @return     string value
+std::string l7vs::ParameterImpl::get_string(
+                                 const l7vs::PARAMETER_COMPONENT_TAG comp,
+                                 const std::string& key,
+                                 l7vs::error_code& err,
+                                 const std::string& file_name ){
+
+    std::vector<std::string> retvec;
+    // get multistring
+    get_multistring( comp, key, retvec, err, file_name );
+
+    if( !err ){
+        // return string
+        return retvec[0];
+    }
+    return std::string("");
+}
+
+//! get multistring parameter
+//! @param[in]    comp       section TAG
+//! @param[in]    key        key string
+//! @param[inout] retvec     string vector
+//! @param[out]   err        error_code
+//! @param[in]    file_name  configuration file name
+//! @return       void
+void l7vs::ParameterImpl::get_multistring( const PARAMETER_COMPONENT_TAG comp,
+                                           const std::string& key,
+                                           std::vector<std::string>& retvec,
+                                           l7vs::error_code& err,
+                                           const std::string& file_name )
+{
+
+    boost::mutex::scoped_lock lock( param_mutex );
+    // error_code clear
+    err.setter(false, "");
+    // find section
+    std::map<PARAMETER_COMPONENT_TAG, std::string>::iterator
+        section_table_iterator = tag_section_table_map.find( comp );
+    // create search key
+    std::string search_key = file_name +"#";
+    search_key += section_table_iterator->second;
+    search_key += ".";
+    search_key += key;
+    retvec.clear();
+    for (multistring_map_type::iterator itr = multistringMap.begin();
+         itr != multistringMap.end(); ++itr ) {
+        // hit search_key
+        if (itr->first == search_key) {
+            retvec.push_back(itr->second);
+        }
+    }
+    // doesn't exist.
+    if (retvec.empty()) {
+        err.setter(true, "don't find key");
+    }
+    return;
+}
+
+
+
+void    l7vs::ParameterImpl::setIntValue(const PARAMETER_COMPONENT_TAG comp, const std::string& key, const int value)
+{
+       std::map< PARAMETER_COMPONENT_TAG, std::string >::iterator      section_table_iterator = tag_section_table_map.find( comp );
+
+        intMap[ section_table_iterator->second + "." + key] = value;
+
+}
+
+void    l7vs::ParameterImpl::setStringValue(const PARAMETER_COMPONENT_TAG comp, const std::string& key, const std::string& value)
+{
+        std::map< PARAMETER_COMPONENT_TAG, std::string >::iterator      section_table_iterator = tag_section_table_map.find( comp );
+        std::string key_str = section_table_iterator->second + "." + key;
+
+        multistringMap.insert( make_pair( key_str , value ) );
+        //multistringMap[ section_table_iterator->second + "." + key ] = value;
+
+}
+
+void    l7vs::ParameterImpl::deleteIntValue(const PARAMETER_COMPONENT_TAG comp, const std::string& key)
+{
+        std::map< PARAMETER_COMPONENT_TAG, std::string >::iterator      section_table_iterator = tag_section_table_map.find( comp );
+        intMap.erase( section_table_iterator->second + "." + key );
+}
+
+void    l7vs::ParameterImpl::deleteStringValue(const PARAMETER_COMPONENT_TAG comp, const std::string& key)
+{
+        std::map< PARAMETER_COMPONENT_TAG, std::string >::iterator      section_table_iterator = tag_section_table_map.find( comp );
+        multistringMap.erase( section_table_iterator->second + "." + key );
+}
+
+
diff --git a/l7vsd/unit_tests/virtualservice_test/parameter_stub/parameter_impl.h b/l7vsd/unit_tests/virtualservice_test/parameter_stub/parameter_impl.h
new file mode 100644 (file)
index 0000000..7dfbb72
--- /dev/null
@@ -0,0 +1,120 @@
+#ifndef PARAMETER_IMPL_H__
+#define PARAMETER_IMPL_H__
+
+#include "parameter_enum.h"
+#include <iostream>
+#include <string>
+#include <map>
+#include <boost/program_options.hpp>
+#include "error_code.h"
+#include "logger_enum.h"
+#include "logger.h"
+
+
+#include <boost/function.hpp>
+#include <boost/noncopyable.hpp>
+#include <boost/thread.hpp>
+
+
+namespace l7vs
+{
+       struct  component{
+               std::string     section;
+               void            (*function)();
+               component(){ section = ""; function = NULL;}
+               component( std::string str, void (*p_func)() ){ section = str; function = p_func;}
+               component& operator=(const component& in_comp){ section = in_comp.section; function = in_comp.function;return *this;}
+       };
+class ParameterImpl : private boost::noncopyable {
+protected:
+    typedef    std::map< std::string, int >               int_map_type;
+    typedef    std::multimap< std::string, std::string >  multistring_map_type;
+
+    //! parameter data of multi string
+    multistring_map_type                    multistringMap;
+    //! parameter data of int
+    int_map_type                            intMap;
+    //! create mutex
+    boost::mutex                            create_mutex;
+    //! read / write mutex
+    boost::mutex                            param_mutex;
+    //! componenttag to section name map
+    std::map< PARAMETER_COMPONENT_TAG, std::string >
+                                            tag_section_table_map;
+    //! constractor
+    ParameterImpl(){}
+    //! destractor
+    ~ParameterImpl(){}
+public:
+    //! instansgetter
+    //! @return instance
+    static ParameterImpl & get_instance(){
+        static ParameterImpl instance;
+        return instance;
+    }
+
+    //! initialize
+    //! @return true success
+    //! @return false failer
+    bool init();
+
+    //! initialize(file designation)
+    //! @param[in]    component tag
+    //! @param[in]    file name
+    //! @return true success
+    //! @return false failer
+    bool init( const PARAMETER_COMPONENT_TAG, const std::string& );
+
+    //! target component read
+    //! @param[in]    component tag
+    //! @param[in]    file name
+    //! @return false failer
+    //! @return true success
+    bool    read_file( const PARAMETER_COMPONENT_TAG, const std::string& );
+
+    //! int value getter
+    //! @param[in]    component tag
+    //! @param[in]    keystring
+    //! @param[out]   errorcode
+    //! @param[in]    file name
+    //! @return int value
+    int get_int( const PARAMETER_COMPONENT_TAG,
+                 const std::string&,
+                 error_code&,
+                 const std::string& );
+
+    //! string value getter
+    //! @param[in]    component tag
+    //! @param[in]    keystring
+    //! @param[out]   errorcode
+    //! @param[in]    file name
+    //! @return string value
+    std::string get_string( const PARAMETER_COMPONENT_TAG,
+                            const std::string&,
+                            error_code&,
+                            const std::string& );
+
+    //! multistring value getter
+    //! @param[in]    component tag
+    //! @param[in]    keystring
+    //! @param[inout] string vector
+    //! @param[out]   errorcode
+    //! @param[in]    file name
+    //! @return       void
+    void get_multistring( const PARAMETER_COMPONENT_TAG,
+                          const std::string&,
+                          std::vector<std::string>&,
+                          error_code&,
+                          const std::string& );
+
+       void    setIntValue(const PARAMETER_COMPONENT_TAG comp, const std::string& key, const int value);
+
+       void    setStringValue(const PARAMETER_COMPONENT_TAG comp, const std::string& key, const std::string& value);
+
+        void    deleteIntValue(const PARAMETER_COMPONENT_TAG comp, const std::string& key);
+        void    deleteStringValue(const PARAMETER_COMPONENT_TAG comp, const std::string& key);
+
+
+       };
+};
+#endif //PARAMETER_IMPL_H__
diff --git a/l7vsd/unit_tests/virtualservice_test/protocol_module_test1.h b/l7vsd/unit_tests/virtualservice_test/protocol_module_test1.h
new file mode 100644 (file)
index 0000000..135c7d0
--- /dev/null
@@ -0,0 +1,179 @@
+#ifndef    PROTOCOL_MODULE_TEST1
+#define    PROTOCOL_MODULE_TEST1
+
+#include "./parameter_stub/parameter.h"
+
+#include    "protocol_module_base.h"
+
+#include "stub.h"
+
+namespace l7vs{
+
+class    protocol_module_test1 : public protocol_module_base{
+public:
+    protocol_module_test1() : protocol_module_base( "PMtest1" ) {
+        std::cout << "PMtest1 create" << std::endl;
+    }
+    ~protocol_module_test1(){
+        std::cout << "PMtest1 destroy" << std::endl;
+    }
+
+    void    initialize(
+                            rs_list_itr_func_type        inlist_begin,
+                            rs_list_itr_func_type        inlist_end,
+                            rs_list_itr_next_func_type    inlist_next,
+                            boost::function< void( void ) >    inlist_lock,
+                            boost::function< void( void ) >    inlist_unlock ){}
+
+    void    finalize(){}
+
+    void    get_option_info( std::string& option ){ option = "protocol args"; };
+
+    bool    is_tcp(){ return true; }
+    bool    is_udp(){ return false; }
+    bool    is_use_sorry(){ return true; }
+    check_message_result    check_parameter( const std::vector<std::string>& args ){
+        protocol_module_base::check_message_result    result;
+        result.flag = true;
+        std::cout << "ProtocolModule check parameter called." << std::endl;
+        return result;
+    }
+
+    void    handle_rslist_update(){}
+
+    check_message_result    set_parameter( const std::vector<std::string>& args ){
+        protocol_module_base::check_message_result    result;
+        result.flag = true;
+        std::cout << "ProtocolModule set parameter called." << std::endl;
+        return result;
+    }
+    check_message_result    add_parameter( const std::vector<std::string>& args ){
+        protocol_module_base::check_message_result    result;
+        result.flag = true;
+        std::cout << "ProtocolModule add parameter called." << std::endl;
+        return result;
+    }
+
+    void    register_schedule( tcp_schedule_func_type inschedule ){}
+
+    void    register_replication_area_lock(
+                                    boost::function< void( void ) > inlock_func ){}
+
+    void    register_replication_area_unlock(
+                                    boost::function< void( void ) > inunlock_func ){}
+
+    void    replication_interrupt(){
+        debugg_flug_struct::getInstance().pm_rep_count_inc();
+        std::cout << "Protocol Module Replication." << std::endl;
+    }
+
+    //use in upstream_thread
+    EVENT_TAG    handle_session_initialize(
+                                    const boost::thread::id up_thread_id,
+                                    const boost::thread::id down_thread_id,
+                                    const boost::asio::ip::tcp::endpoint& client_endpoint_tcp,
+                                    const boost::asio::ip::udp::endpoint& client_endpoint_udp ){return STOP;}
+
+    EVENT_TAG    handle_session_finalize(
+                                    const boost::thread::id up_thread_id,
+                                    const boost::thread::id down_thread_id ){return STOP;}
+
+    EVENT_TAG    handle_accept( const boost::thread::id thread_id ){return STOP;}
+
+    EVENT_TAG    handle_client_recv(
+                                    const boost::thread::id thread_id,
+                                    const boost::array<char,MAX_BUFFER_SIZE>& recvbuffer,
+                                    const size_t recvlen ){return STOP;}
+
+    EVENT_TAG    handle_realserver_select(
+                                    const boost::thread::id thread_id,
+                                    boost::asio::ip::tcp::endpoint& rs_endpoint ){return STOP;}
+
+    EVENT_TAG    handle_realserver_connect(
+                                    const boost::thread::id thread_id,
+                                    boost::array<char,MAX_BUFFER_SIZE>& sendbuffer,
+                                    size_t& datalen ){return STOP;}
+    
+    EVENT_TAG    handle_realserver_connection_fail(
+                                    const boost::thread::id thread_id,
+                                    const boost::asio::ip::tcp::endpoint& rs_endpoint ){return STOP;}
+    
+    EVENT_TAG    handle_realserver_send( const boost::thread::id thread_id ){return STOP;}
+    
+    EVENT_TAG    handle_sorryserver_select(
+                                    const boost::thread::id thread_id,
+                                    boost::asio::ip::tcp::endpoint & sorry_endpoint ){return STOP;}
+
+    EVENT_TAG    handle_sorryserver_connect(
+                                    const boost::thread::id thread_id,
+                                    boost::array<char,MAX_BUFFER_SIZE>& sendbuffer,
+                                    size_t& datalen ){return STOP;}
+
+    EVENT_TAG    handle_sorryserver_connection_fail(
+                                    const boost::thread::id thread_id,
+                                    const boost::asio::ip::tcp::endpoint& sorry_endpoint ){return STOP;}
+    
+    EVENT_TAG    handle_sorryserver_send( const boost::thread::id thread_id ){return STOP;}
+
+    //use in downstream_thread
+    EVENT_TAG    handle_realserver_recv(
+                                    const boost::thread::id thread_id,
+                                    const boost::asio::ip::tcp::endpoint & rs_endpoint,
+                                    const boost::array<char,MAX_BUFFER_SIZE>& recvbuffer,
+                                    const size_t recvlen ){return STOP;}
+    
+    EVENT_TAG    handle_sorryserver_recv(
+                                    const boost::thread::id thread_id,
+                                    const boost::asio::ip::tcp::endpoint & sorry_endpoint,
+                                    const boost::array<char,MAX_BUFFER_SIZE>& readbuffer,
+                                    const size_t recvlen ){return STOP;}
+    
+    EVENT_TAG    handle_response_send_inform( const boost::thread::id thread_id ){return STOP;}
+
+    EVENT_TAG    handle_client_connection_check(
+                                    const boost::thread::id thread_id,
+                                    boost::array<char,MAX_BUFFER_SIZE>& sendbuffer,
+                                    size_t& datalen ){return STOP;}
+
+    EVENT_TAG    handle_client_send( const boost::thread::id thread_id ){return STOP;}
+
+    //use in upstream/downstream thread
+    EVENT_TAG    handle_client_disconnect( const boost::thread::id thread_id ){return STOP;}
+    
+    EVENT_TAG    handle_sorry_enable( const boost::thread::id upthread_id ){return STOP;}
+
+    EVENT_TAG    handle_sorry_disable( const boost::thread::id upthread_id ){return STOP;}
+
+    EVENT_TAG    handle_realserver_disconnect(
+                                    const boost::thread::id thread_id,
+                                    const boost::asio::ip::tcp::endpoint & rs_endpoint ){return STOP;}
+    
+    EVENT_TAG    handle_sorryserver_disconnect(
+                                    const boost::thread::id thread_id,
+                                    const boost::asio::ip::tcp::endpoint & sorry_endpoint ){return STOP;}
+
+    //unuse method
+    void    register_schedule( udp_schedule_func_type inschedule ){}
+    EVENT_TAG    handle_realserver_select(
+                                    const boost::thread::id thread_id,
+                                    boost::asio::ip::udp::endpoint& rs_endpoint,
+                                    boost::array<char,MAX_BUFFER_SIZE>& sendbuffer,
+                                    size_t& datalen ){return STOP;}
+    EVENT_TAG    handle_realserver_recv(
+                                    const boost::thread::id thread_id,
+                                    const boost::asio::ip::udp::endpoint & rs_endpoint,
+                                    const boost::array<char,MAX_BUFFER_SIZE>& readbuffer,
+                                    const size_t recvlen ){return STOP;}
+    EVENT_TAG    handle_client_select(
+                                    const boost::thread::id thread_id,
+                                    boost::asio::ip::udp::endpoint& rs_endpoint,
+                                    boost::array<char,MAX_BUFFER_SIZE>& sendbuffer,
+                                    size_t& datalen ){return STOP;}
+    EVENT_TAG    handle_realserver_close(
+                                    const boost::thread::id thread_id,
+                                    const boost::asio::ip::udp::endpoint & rs_endpoint ){return STOP;};
+};
+
+}
+
+#endif
diff --git a/l7vsd/unit_tests/virtualservice_test/schedule_module_test1.h b/l7vsd/unit_tests/virtualservice_test/schedule_module_test1.h
new file mode 100644 (file)
index 0000000..89fa2e0
--- /dev/null
@@ -0,0 +1,53 @@
+#ifndef    SCHEDULE_MODULE_TEST1_H
+#define    SCHEDULE_MODULE_TEST1_H
+
+#include "./parameter_stub/parameter.h"
+
+
+#include    "schedule_module_base.h"
+#include <iostream>
+
+#include "stub.h"
+
+namespace l7vs{
+
+class    schedule_module_test1 : public schedule_module_base{
+protected:
+//    boost::asio::ip::tcp::endpoint    tcp_endpoint ;
+//    boost::asio::ip::udp::endpoint    udp_endpoint ;
+public:
+    schedule_module_test1() : schedule_module_base( "SMtest1" ) {
+        std::cout << "SMtest1 create" << std::endl;
+    }
+    ~schedule_module_test1(){
+        std::cout << "SMtest1 destroy" << std::endl;
+    }
+
+    void    initialize(){}
+
+    bool    is_tcp(){ return true; }
+    bool    is_udp(){ return false; }
+
+    void    handle_schedule(
+                            boost::thread::id                    thread_id,
+                            rslist_iterator_begin_func_type        inlist_begin,
+                            rslist_iterator_end_func_type        inlist_end,
+                            rslist_iterator_next_func_type        inlist_next,
+                            boost::asio::ip::tcp::endpoint&    outendpoint ){}
+
+    void    handle_schedule(
+                            boost::thread::id                    thread_id,
+                            rslist_iterator_begin_func_type        inlist_begin,
+                            rslist_iterator_end_func_type        inlist_end,
+                            rslist_iterator_next_func_type        inlist_next,
+                            boost::asio::ip::udp::endpoint&    outendpoint ){}
+
+    void    replication_interrupt(){
+        debugg_flug_struct::getInstance().sm_rep_count_inc();
+        std::cout << "Schedule Module Replication." << std::endl;
+    }
+};
+
+}
+
+#endif
diff --git a/l7vsd/unit_tests/virtualservice_test/sslfiles/ssl_conf.cf b/l7vsd/unit_tests/virtualservice_test/sslfiles/ssl_conf.cf
new file mode 100644 (file)
index 0000000..8fa5f19
--- /dev/null
@@ -0,0 +1,31 @@
+[ssl]
+
+# Global configuration.                                →基本項目(行頭の#はコメント行、行頭以外の#は不可)
+timout_sec = 30
+
+# SSL configuration.                                   →SSL項目(行頭の#はコメント行、行頭以外の#は不可)
+#ca_dir = "/home/komata/KomataCA/certs"
+ca_dir = "/home/komata/KomataCA/"
+ca_file = "CAfile.pem"
+cert_chain_dir = "/home/komata/KomataCA/SERVER/"
+cert_chain_file = "cert.pem"
+private_key_dir = "/home/komata/KomataCA/SERVER/"
+private_key_file = "server.key"
+private_key_filetype = "SSL_FILETYPE_PEM"
+private_key_passwd_dir = "/home/komata/KomataCA/SERVER/"
+private_key_passwd_file = "passwd.txt"
+verify_options = "SSL_VERIFY_PEER"
+verify_options = "SSL_VERIFY_FAIL_IF_NO_PEER_CERT"
+verify_cert_depth = 4 
+ssl_options = "SSL_OP_ALL"
+ssl_options = "SSL_OP_NO_SSLv2"
+ssl_options = "SSL_OP_SINGLE_DH_USE"
+tmp_dh_dir = "/home/komata/KomataCA/"
+tmp_dh_file = "dh512.pem"
+cipher_list = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH"
+
+# SSL session cache configuration.                     →SSLセッションキャッシュ用の設定(OpenSSL標準の内部セッションキャッシュを使用)
+session_cache = "on"
+session_cache_size = 20480
+session_cache_timeout = 300
+
diff --git a/l7vsd/unit_tests/virtualservice_test/stub.cpp b/l7vsd/unit_tests/virtualservice_test/stub.cpp
new file mode 100644 (file)
index 0000000..4320e92
--- /dev/null
@@ -0,0 +1,603 @@
+#include <boost/asio.hpp>
+
+#include "l7vsd.h"
+#include "data_buff_base.h"
+#include "tcp_thread_message.h"
+//#include "tcp_thread_message_que.h"
+#include "tcp_data.h"
+#include "tcp_socket.h"
+#include "tcp_session.h"
+#include "udp_session.h"
+#include "parameter.h"
+#include "replication.h"
+#include "protocol_module_control.h"
+#include "schedule_module_control.h"
+#include "error_code.h"
+#include "stub.h"
+#include "protocol_module_test1.h"
+#include "schedule_module_test1.h"
+
+
+
+l7vs::session_result_message    result;
+
+
+// protocol_module_control STUB code
+l7vs::protocol_module_control&    l7vs::protocol_module_control::getInstance(){
+    static    protocol_module_control    instance;
+    return    instance;
+}
+void    l7vs::protocol_module_control::initialize( const std::string& infile_path ){}
+void    l7vs::protocol_module_control::finalize(){}
+l7vs::protocol_module_base*    l7vs::protocol_module_control::load_module( const std::string& modulename ){
+       l7vs::protocol_module_base* return_value = NULL;
+
+       if( !debugg_flug_struct::getInstance().pmcontrol_err_flag() )
+               return_value = new l7vs::protocol_module_test1();
+
+       return return_value;
+}
+void   l7vs::protocol_module_control::unload_module( protocol_module_base* module_ptr ){
+       delete  module_ptr;
+}
+
+l7vs::schedule_module_control& l7vs::schedule_module_control::getInstance(){
+       static  schedule_module_control instance;
+       return  instance;
+}
+void   l7vs::schedule_module_control::initialize( const std::string& infile_path ){}
+void   l7vs::schedule_module_control::finalize(){}
+l7vs::schedule_module_base*    l7vs::schedule_module_control::load_module( const std::string& modulename ){
+       l7vs::schedule_module_base* return_value = NULL;
+
+       if( !debugg_flug_struct::getInstance().smcontrol_err_flag() )
+               return_value = new schedule_module_test1;
+
+       return return_value;
+}
+
+void   l7vs::schedule_module_control::unload_module( schedule_module_base* module_ptr ){
+       delete module_ptr;
+}
+
+/*
+// parameter stub
+l7vs::Parameter::Parameter(){}
+
+l7vs::Parameter::~Parameter(){}
+
+bool    l7vs::Parameter::read_file( const PARAMETER_COMPONENT_TAG in,const std::string& filename ){    return true; }
+
+int        l7vs::Parameter::get_int(    const PARAMETER_COMPONENT_TAG in_tag,
+                                    const std::string& in_str,
+                                    error_code& err ){
+    int    retval = 0;
+    if( debugg_flug_struct::getInstance().param_exist_flag() ){
+        retval = SESSION_POOL_NUM_PARAM;
+    }else{
+        err.setter( true, "not exist value." );
+    }
+    return retval;
+}
+bool l7vs::Parameter::init( const PARAMETER_COMPONENT_TAG in_tag, const std::string& data){
+
+    return(true);
+}
+std::string        l7vs::Parameter::get_string(const PARAMETER_COMPONENT_TAG in_tag,
+                                            const std::string& in_str,
+                                            error_code& err){
+    return "";
+}
+
+
+void l7vs::Parameter::get_multistring(const PARAMETER_COMPONENT_TAG,
+                         const std::string&,
+                         std::vector<std::string>&,
+                         error_code& ){
+
+
+}
+*/
+l7vs::Logger::Logger() :
+    scopedLogCategory(LOG_CAT_L7VSD_LOGGER),
+    scopedLogId(0),
+    scopedLogMessage("Logger Constructor"),
+    scopedLogFile(__FILE__),
+    scopedLogLine(__LINE__) {}
+
+l7vs::Logger::Logger( LOG_CATEGORY_TAG cat, const unsigned int id, const std::string& msg, const char* file, int line) :
+    scopedLogCategory(cat),
+    scopedLogId(id),
+    scopedLogMessage(msg),
+    scopedLogFile(file),
+    scopedLogLine(line) {}
+
+l7vs::Logger::~Logger(){}
+
+void    l7vs::Logger::loadConf(){}
+
+l7vs::LOG_LEVEL_TAG l7vs::Logger::getLogLevel( l7vs::LOG_CATEGORY_TAG ){
+    l7vs::LOG_LEVEL_TAG        ret_tag = l7vs::LOG_LV_DEBUG;
+    return ret_tag;
+}
+
+bool    l7vs::Logger::setLogLevel( l7vs::LOG_CATEGORY_TAG cat, l7vs::LOG_LEVEL_TAG level ){
+    return true;
+}
+
+void    l7vs::Logger::putLogFatal( l7vs::LOG_CATEGORY_TAG, const unsigned int, const std::string& msg, const char*, int ){
+    std::cout << "FATAL : " << msg << std::endl;
+}
+
+void    l7vs::Logger::putLogError( l7vs::LOG_CATEGORY_TAG, const unsigned int, const std::string& msg, const char*, int ){
+    std::cout << "ERROR : " << msg << std::endl;
+}
+
+void    l7vs::Logger::putLogWarn( l7vs::LOG_CATEGORY_TAG, const unsigned int, const std::string& msg, const char*, int ){
+    std::cout << "WARN  : " << msg << std::endl;
+}
+
+void    l7vs::Logger::putLogInfo( l7vs::LOG_CATEGORY_TAG, const unsigned int, const std::string& msg, const char*, int ){
+    std::cout << "INFO  : " << msg << std::endl;
+}
+
+void    l7vs::Logger::putLogDebug( l7vs::LOG_CATEGORY_TAG, const unsigned int, const std::string& msg, const char*, int ){
+    std::cout << "DEBUG : " << msg << std::endl;
+}
+
+l7vs::l7vsd::l7vsd(){}
+l7vs::l7vsd::~l7vsd(){}
+l7vs::l7vsd::vslist_type::iterator    l7vs::l7vsd::search_vslist( const virtualservice_element& )    const{
+    return vslist.begin();
+}
+
+void    l7vs::l7vsd::release_virtual_service( const virtualservice_element& ) const {}
+
+
+int        l7vs::replication::initialize(){
+    return 0;
+}
+void    l7vs::replication::finalize(){}
+void    l7vs::replication::switch_to_master(){}
+void    l7vs::replication::switch_to_slave(){}
+void*    l7vs::replication::pay_memory( const std::string& inid, unsigned int& outsize ){
+       void* retval = debugg_flug_struct::getInstance().get_rep_area();
+       outsize = l7vs::virtualservice_base::MAX_REPLICATION_DATA_NUM;
+       return retval;
+}
+void    l7vs::replication::dump_memory(){}
+void    l7vs::replication::start(){}
+void    l7vs::replication::stop(){}
+void    l7vs::replication::force_replicate(){}
+void    l7vs::replication::reset(){}
+l7vs::replication::REPLICATION_MODE_TAG    l7vs::replication::get_status(){
+    l7vs::replication::REPLICATION_MODE_TAG    retmode = l7vs::replication::REPLICATION_OUT;
+    return retmode;
+}
+int        l7vs::replication::handle_send(){
+    return 0;
+}
+void        l7vs::replication::handle_receive( const boost::system::error_code& err, size_t size ){
+}
+int        l7vs::replication::lock( const std::string& inid ){
+    return 0;
+}
+int        l7vs::replication::unlock( const std::string& inid ){
+    return 0;
+}
+int        l7vs::replication::refer_lock_mutex( const std::string& inid, mutex_ptr& outmutex ){
+    return 0;
+}
+
+/*
+l7vs::data_buff_base::data_buff_base(){}
+l7vs::data_buff_base::~data_buff_base(){}
+void    l7vs::data_buff_base::initialize(){}
+std::size_t    l7vs::data_buff_base::get_size(){
+    return send_size;
+}
+void    l7vs::data_buff_base::set_size(const std::size_t set_size){}
+boost::array< char , MAX_BUFFER_SIZE>&    l7vs::data_buff_base::get_data(){
+    return data;
+}
+void    l7vs::data_buff_base::set_data(const boost::array< char , MAX_BUFFER_SIZE>& data){}
+void    l7vs::data_buff_base::set_send_size(const std::size_t set_size){}
+std::size_t    l7vs::data_buff_base::get_send_size(){
+    return send_size;
+}
+*/
+l7vs::tcp_realserver_connect_socket_list::tcp_realserver_connect_socket_list(){}
+l7vs::tcp_realserver_connect_socket_list::~tcp_realserver_connect_socket_list(){}
+void   l7vs::tcp_realserver_connect_socket_list::push_back(list_element realserver_socket){}
+l7vs::tcp_realserver_connect_socket_list::list_element l7vs::tcp_realserver_connect_socket_list::get_socket(){
+       l7vs::tcp_realserver_connect_socket_list::list_element  retval;
+       return retval;
+}
+bool   l7vs::tcp_realserver_connect_socket_list::empty(){
+       return true;
+}
+
+//l7vs::tcp_thread_message::tcp_thread_message(){}
+//l7vs::tcp_thread_message::~tcp_thread_message(){}
+/*
+l7vs::tcp_thread_message_que::tcp_thread_message_que(){}
+l7vs::tcp_thread_message_que::~tcp_thread_message_que(){}
+void   l7vs::tcp_thread_message_que::push(tcp_thread_message_ptr message){}
+l7vs::tcp_thread_message_que::tcp_thread_message_ptr   l7vs::tcp_thread_message_que::front(){
+       return message_que.front();
+}
+bool   l7vs::tcp_thread_message_que::empty(){
+       return true;
+}
+void   l7vs::tcp_thread_message_que::clear(){}
+*/
+/*
+l7vs::tcp_data::tcp_data(){}
+l7vs::tcp_data::~tcp_data(){}
+void    l7vs::tcp_data::initialize(){}
+void    l7vs::tcp_data::set_endpoint(const boost::asio::ip::tcp::endpoint set_endpoint){}
+boost::asio::ip::tcp::endpoint    l7vs::tcp_data::get_endpoint(){
+    return endpoint_info;
+}
+*/
+
+
+//l7vs::tcp_socket::tcp_socket(boost::asio::io_service& io, const tcp_socket_option_info set_option): my_socket(io), open_flag(false), opt_info(set_option){
+//}
+
+//l7vs::tcp_socket::tcp_socket(boost::asio::io_service& io) : my_socket( io ){}
+//l7vs::tcp_socket::~tcp_socket(){}
+//boost::asio::ip::tcp::socket&        l7vs::tcp_socket::get_socket(){
+//     return my_socket;
+//}
+bool   l7vs::tcp_socket::connect(const boost::asio::ip::tcp::endpoint connect_endpoint,boost::system::error_code& ec){
+       return true;
+}
+bool   l7vs::tcp_socket::close(boost::system::error_code& ec){
+       return true;
+}
+bool   l7vs::tcp_socket::set_non_blocking_mode(boost::system::error_code& ec){
+       return true;
+}
+std::size_t            l7vs::tcp_socket::write_some(boost::asio::mutable_buffers_1 buffers, boost::system::error_code& ec){
+       size_t  ret = 0;
+       return ret;
+}
+std::size_t            l7vs::tcp_socket::read_some(boost::asio::mutable_buffers_1 buffers, boost::system::error_code& ec){
+       size_t  ret = 0;
+       return ret;
+}
+
+
+
+
+l7vs::tcp_session::tcp_session(virtualservice_tcp& vs,
+            boost::asio::io_service& session_io,
+            const tcp_socket_option_info set_option,
+            const boost::asio::ip::tcp::endpoint listen_endpoint,
+            const bool ssl_mode,
+            boost::asio::ssl::context& set_ssl_context,
+            const bool set_ssl_cache_flag,
+            const int set_ssl_handshake_time_out,
+            logger_implement_access* set_access_logger)
+        :
+        io(session_io),
+        parent_service(vs),
+        exit_flag(false),
+        thread_state(0),
+        protocol_module(NULL),
+        session_pause_flag(false),
+        client_socket(session_io,set_option),
+        upstream_buffer_size(8192),
+        downstream_buffer_size(8192),
+        virtualservice_endpoint(listen_endpoint),
+        access_log_flag(false),
+        access_logger(set_access_logger),
+        ssl_flag(ssl_mode),
+        client_ssl_socket(session_io, set_ssl_context,set_option),
+        ssl_context(set_ssl_context),
+        ssl_cache_flag(set_ssl_cache_flag),
+        ssl_handshake_timer_flag(false),
+        ssl_handshake_time_out(set_ssl_handshake_time_out),
+        ssl_handshake_time_out_flag(false),
+        socket_opt_info(set_option){
+
+    exit_flag = false;
+    session_pause_flag = false;
+    std::cout << "SESSION:CREATE" << std::endl;
+}
+
+l7vs::tcp_session::~tcp_session(void){}
+l7vs::session_result_message l7vs::tcp_session::initialize(void){
+       l7vs::session_result_message    result;
+       result.flag = false;
+       return result;
+}
+
+
+//l7vs::session_result_message l7vs::tcp_session::initialize(void){
+//    return(result);
+//}
+
+boost::asio::ip::tcp::socket& l7vs::tcp_session::get_client_socket(void){
+    return client_socket.get_socket();
+}
+
+ssl_socket& l7vs::tcp_session::get_client_ssl_socket()
+{
+    return client_ssl_socket.get_socket();
+}
+
+bool    l7vs::tcp_session::is_thread_wait(void){
+    return true;
+}
+
+void    l7vs::tcp_session::set_virtual_service_message(const TCP_VIRTUAL_SERVICE_MESSAGE_TAG  message){
+    switch( message ){
+    case SORRY_STATE_ENABLE:
+        {
+            boost::mutex::scoped_lock( exit_flag_update_mutex );
+            exit_flag = true;
+        }
+        break;
+    case SORRY_STATE_DISABLE:
+        {
+            boost::mutex::scoped_lock( exit_flag_update_mutex );
+            exit_flag = false;
+        }
+        break;
+    case SESSION_END:
+        {
+            boost::mutex::scoped_lock( exit_flag_update_mutex );
+            boost::mutex::scoped_lock( module_function_sorry_disable_mutex );
+            exit_flag = true;
+            session_pause_flag = true;
+        }
+        break;
+    case SESSION_PAUSE_ON:
+        {
+            boost::mutex::scoped_lock( module_function_sorry_disable_mutex );
+            session_pause_flag = true;
+        }
+        break;
+    case SESSION_PAUSE_OFF:
+        {
+            boost::mutex::scoped_lock( module_function_sorry_disable_mutex );
+            session_pause_flag = false;
+        }
+        break;
+    case    ACCESS_LOG_ON:{
+        std::cout<< "set_virtual_service_message called : ACCESS_LOG_ON" << std::endl;
+        break;
+    }
+    case    ACCESS_LOG_OFF:{
+        std::cout<< "set_virtual_service_message called : ACCESS_LOG_OFF" << std::endl;
+        break;
+    }
+
+
+    }
+}
+
+void   l7vs::tcp_session::up_thread_run(void){
+       size_t  count = 0;
+       std::cout << "active session";
+       std::cout << boost::this_thread::get_id() << std::endl;
+       exit_flag = false;
+       while( !exit_flag ){
+               ++count;
+               if( !debugg_flug_struct::getInstance().session_loop_flag() && (count > 30000) )
+                       break;
+       }
+       std::cout << "release session";
+       parent_service.release_session( this );
+}
+
+void   l7vs::tcp_session::down_thread_run(void){}
+
+void    l7vs::tcp_session::thread_state_update(const std::bitset<TCP_SESSION_THREAD_STATE_BIT> thread_flag,const bool regist){}
+void    l7vs::tcp_session::up_thread_client_accept_event(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::up_thread_client_receive(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::up_thread_client_respond(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::up_thread_client_respond_event(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::up_thread_client_disconnect(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::up_thread_client_disconnect_event(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::up_thread_realserver_send(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::up_thread_realserver_get_destination_event(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::up_thread_realserver_connect(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::up_thread_realserver_connect_event(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::up_thread_realserver_connection_fail_event(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::up_thread_realserver_disconnect(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::up_thread_realserver_disconnect_event(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::up_thread_all_realserver_disconnect(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::up_thread_sorryserver_send(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::up_thread_sorryserver_get_destination_event(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::up_thread_sorryserver_connect(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::up_thread_sorryserver_connect_event(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::up_thread_sorryserver_connection_fail_event(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::up_thread_sorryserver_disconnect(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::up_thread_sorryserver_disconnect_event(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::up_thread_sorry_enable_event(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::up_thread_sorry_disable_event(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::up_thread_sorryserver_mod_disconnect(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::up_thread_exit(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::up_thread_all_socket_close(void){}
+
+void    l7vs::tcp_session::down_thread_realserver_receive(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::down_thread_realserver_disconnect(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::down_thread_realserver_disconnect_event(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::down_thread_all_realserver_disconnect(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::down_thread_client_connection_chk_event(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::down_thread_client_respond_event(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::down_thread_client_send(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::down_thread_client_disconnect(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::down_thread_client_disconnect_event(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::down_thread_sorryserver_receive(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::down_thread_sorryserver_disconnect(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::down_thread_sorryserver_disconnect_event(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::down_thread_sorry_enable_event(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::down_thread_sorryserver_mod_disconnect(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::down_thread_sorry_disable_event(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::down_thread_exit(const TCP_PROCESS_TYPE_TAG process_type){}
+void    l7vs::tcp_session::down_thread_all_socket_close(){}
+
+void    l7vs::tcp_session::up_thread_client_accept(const TCP_PROCESS_TYPE_TAG process_type){}
+
+void    l7vs::tcp_session::handle_ssl_handshake_timer(const boost::system::error_code& error){}
+
+bool    l7vs::tcp_session::ssl_clear_keep_cache(ssl_st*){ return(true); }
+
+std::string l7vs::tcp_session::endpoint_to_string(
+        const boost::asio::ip::tcp::endpoint& target_endpoint){ return(std::string("")); }
+
+
+l7vs::udp_session::udp_session(virtualservice_udp& vs, boost::asio::io_service& session_io) :    io( session_io ),
+                                                                                                parent_service( vs ),
+                                                                                                client_side_socket( io ) {}
+l7vs::udp_session::~udp_session(){}
+l7vs::session_result_message    l7vs::udp_session::initialize(const udp_endpoint listen_end){
+    l7vs::session_result_message    result;
+    return result;
+}
+
+void    l7vs::udp_session::set_virtual_service_message(const UDP_VIRTUAL_SERVICE_MESSAGE_TAG message){}
+void    l7vs::udp_session::run(void){}
+bool    l7vs::udp_session::client_send(const udp_endpoint client_endpoint, const udp_session_buff& data_buff,const std::size_t data_size,boost::system::error_code& ec){
+    return true;
+}
+void    l7vs::udp_session::release_request(const boost::thread::id release_thread_id){}
+
+void    l7vs::udp_session::make_request_thread(const int max_count){}
+void    l7vs::udp_session::active_request_thread(const udp_endpoint client_endpoint , const udp_session_buff receive_data, const std::size_t receive_size){}
+void    l7vs::udp_session::all_active_request_stop(void){}
+
+
+void   l7vs::session_thread_control::upstream_run(){
+       state_tag       state;
+       upthread_running_mutex.lock();
+       {       // get first state from class upstream state.
+               rw_scoped_lock  upstate_lock( upthread_state_mutex );
+               state = upthread_state; //thread local state is update.
+       }
+       for(;;){        // thread loop
+               if( state == WAIT ){    // after create or session end. this thread is pooling mode
+                       boost::mutex::scoped_lock       lock( upthread_condition_mutex );
+//                     upthread_condition.wait( lock );        // thread is condition wait.( start at notify_all() )
+                       boost::xtime    wait;
+                       boost::xtime_get( &wait, boost::TIME_UTC );
+                       wait.sec += 1;
+                       upthread_running_mutex.unlock();
+                       upthread_condition.timed_wait( lock, wait ); // thread is condition wait( start at notify_all() )
+                       upthread_running_mutex.lock();
+               }
+               else if( state == EXIT ){ // this state is vitrualservice end. thread is finishing.
+                       break;
+               }
+               else{   //state RUNNING
+                       session->up_thread_run();       //session upstream thread looping.
+                       stopupstream();
+               }
+               rw_scoped_lock  upstate_lock( upthread_state_mutex );
+               state = upthread_state; //thread local state is update.
+       }
+       upthread_running_mutex.unlock();
+       boost::mutex::scoped_lock up_lk( upthread_joining_mutex );
+       upthread_joining_condition.notify_all();
+}
+
+void   l7vs::session_thread_control::downstream_run(){
+       state_tag       state;
+       downthread_running_mutex.lock();
+       {
+               rw_scoped_lock  downstate_lock( downthread_state_mutex );
+               state = downthread_state;       //thread local state is update.
+       }
+       for(;;){        //thread loop
+               if( state == WAIT ){    //after create or session end. this thread is pooling mode
+                       boost::mutex::scoped_lock       lock( downthread_condition_mutex );
+//                     downthread_condition.wait( lock ); // thread is condition wait( start at notify_all() )
+                       boost::xtime    wait;
+                       boost::xtime_get( &wait, boost::TIME_UTC );
+                       wait.sec += 1;
+                       downthread_running_mutex.unlock();
+                       downthread_condition.timed_wait( lock, wait ); // thread is condition wait( start at notify_all() )
+                       downthread_running_mutex.lock();
+               }
+               else if( state == EXIT ){// this state is vitrualservice end. thread is finishing.
+                       break;
+               }
+               else{   //state RUNNING
+                       session->down_thread_run();//session downstream thread looping.
+                       stopdownstream();
+               }
+               rw_scoped_lock  downstate_lock( downthread_state_mutex );
+               state = downthread_state;       // thread local sate is update.
+       }
+       downthread_running_mutex.unlock();
+       boost::mutex::scoped_lock down_lk( downthread_joining_mutex );
+       downthread_joining_condition.notify_all();
+}
+
+void   l7vs::session_thread_control::startupstream(){
+       boost::mutex::scoped_lock       lock( upthread_condition_mutex );       //upstream state lock
+       if( upthread_state != EXIT ) upthread_state = RUNNING;          // upthread state update.[RUNNING] -> alive mode
+       upthread_condition.notify_all();                                                        // conditionwait upstreamthread is run.
+}
+
+void   l7vs::session_thread_control::stopupstream(){
+       boost::mutex::scoped_lock       lock( upthread_condition_mutex );       // upstream state lock
+       if( upthread_state != EXIT ) upthread_state = WAIT;                             // upthread state is update [WAIT] -> pooling mode
+}
+
+void   l7vs::session_thread_control::startdownstream(){
+       boost::mutex::scoped_lock       lock( downthread_condition_mutex );             // downstream state lock
+       if( downthread_state != EXIT ) downthread_state = RUNNING;              // downstream state is update [RUNNING] -> alive mode
+       downthread_condition.notify_all();                                                              // condition wait thread is run.
+}
+
+void   l7vs::session_thread_control::stopdownstream(){
+       boost::mutex::scoped_lock       lock( downthread_condition_mutex );     // downstream state lock
+       if( downthread_state != EXIT ) downthread_state = WAIT;                 // downstream state is update [WAIT] -> pooling mode
+}
+
+void   l7vs::session_thread_control::join(){
+
+       boost::mutex::scoped_lock       up_lk( upthread_joining_mutex );
+       boost::mutex::scoped_lock       down_lk( downthread_joining_mutex );
+
+       {
+               rw_scoped_lock  upstate_lock( upthread_state_mutex );
+               upthread_state = EXIT;  //upstream state update [EXIT] -> thread exit mode
+       }
+       {
+               boost::mutex::scoped_lock upthread_running_wait( upthread_running_mutex );
+               upthread_condition.notify_all();        // conditionwait thread is run
+       }
+
+       {
+               rw_scoped_lock  downstate_lock( downthread_state_mutex );
+               downthread_state = EXIT;        //downstream state update [EXIT] -> thread exit mode
+       }
+       {
+               boost::mutex::scoped_lock downthread_running_wait( downthread_running_mutex );
+               downthread_condition.notify_all(); //condition wait thread is run.
+       }
+       upthread_joining_condition.wait( up_lk );
+       downthread_joining_condition.wait( down_lk );
+       if( LOG_LV_DEBUG == l7vs::Logger::getLogLevel( l7vs::LOG_CAT_L7VSD_VIRTUALSERVICE ) ){
+       boost::format fmt("out_function : void session_thread_control::stopd ownstream() : up_status = %d / down_status = %d");
+               fmt % upthread_state % downthread_state;
+               l7vs::Logger::putLogDebug( l7vs::LOG_CAT_L7VSD_VIRTUALSERVICE, 15, fmt.str(), __FILE__, __LINE__ );
+       }
+
+}
+
+boost::mutex&  l7vs::session_thread_control::get_upthread_mutex(){
+       return  upthread_running_mutex;
+}
+
+boost::mutex&  l7vs::session_thread_control::get_downthread_mutex(){
+       return  downthread_running_mutex;
+}
+
+
diff --git a/l7vsd/unit_tests/virtualservice_test/stub.h b/l7vsd/unit_tests/virtualservice_test/stub.h
new file mode 100644 (file)
index 0000000..366ec4c
--- /dev/null
@@ -0,0 +1,89 @@
+#ifndef    STUB_H
+#define    STUB_H
+
+#include "./parameter_stub/parameter.h"
+
+
+#include "virtualservice.h"
+#include "parameter_enum.h"
+
+#define    SESSION_POOL_NUM_PARAM    (512)
+
+class    debugg_flug_struct{
+protected:
+    bool    session_pool_param_flg;
+    bool    session_loop_mode;
+    bool    pmcontrol_error_flag;
+    bool    smcontrol_error_flag;
+    bool    pm_function_called;
+    l7vs::LOG_LEVEL_TAG    loglevel;
+
+    int        pm_rep_count;
+    int        sm_rep_count;
+
+    char*    rep_area;
+
+
+
+    debugg_flug_struct() : session_pool_param_flg( false ),
+                                pm_rep_count( 0 ),
+                                sm_rep_count( 0 ) {
+        loglevel = l7vs::LOG_LV_ERROR;
+        session_loop_mode = true;
+    }
+    debugg_flug_struct( const debugg_flug_struct & in ){ rep_area = NULL; }
+    debugg_flug_struct& operator=( const debugg_flug_struct & in ){ return *this; }
+public:
+    bool read_file(const l7vs::PARAMETER_COMPONENT_TAG,
+                   const std::string& = "/etc/l7vs/l7vs.cf" );
+    static debugg_flug_struct&    getInstance(){
+        static    debugg_flug_struct    instance;
+        return    instance;
+    }
+    bool&    session_loop_flag(){
+        return session_loop_mode;
+    }
+    l7vs::LOG_LEVEL_TAG&    stub_loglevel(){
+        return loglevel;
+    }
+    bool&    param_exist_flag(){
+        return session_pool_param_flg;
+    }
+    bool&    pmcontrol_err_flag(){
+        return pmcontrol_error_flag;
+    }
+    bool&    smcontrol_err_flag(){
+        return smcontrol_error_flag;
+    }
+    bool&    pm_function_called_flag(){
+        return pm_function_called;
+    }
+    void    pm_rep_count_inc(){
+        pm_rep_count = pm_rep_count+1;
+    }
+    int        get_pm_rep_count(){
+        return pm_rep_count;
+    }
+    void    sm_rep_count_inc(){
+        sm_rep_count = sm_rep_count+1;
+    }
+    int        get_sm_rep_count(){
+        return sm_rep_count;
+    }
+    void    create_rep_area(){
+        if( NULL == rep_area )
+            rep_area = new char[(l7vs::virtualservice_base::MAX_REPLICATION_DATA_NUM)*480];
+            memset( rep_area, 0, (sizeof(char)*480*l7vs::virtualservice_base::MAX_REPLICATION_DATA_NUM) );
+    }
+    void*    get_rep_area(){
+        return reinterpret_cast<void*>( rep_area );
+    }
+    void    destroy_rep_area(){
+        if( NULL != rep_area ){
+            delete [] rep_area;
+            rep_area = NULL;
+        }
+    }
+};
+
+#endif
diff --git a/l7vsd/unit_tests/virtualservice_test/virtualservice.cpp b/l7vsd/unit_tests/virtualservice_test/virtualservice.cpp
new file mode 100644 (file)
index 0000000..8109b48
--- /dev/null
@@ -0,0 +1,143 @@
+//
+//!    @file    virtualservice.cpp
+//!    @brief    VirtualService class implementations
+//
+//    copyright (c) sdy corporation. 2008
+//    mail: h dot okada at sdy dot co dot jp
+//
+//    Distributed under the Boost Software License, Version 1.0.(See accompanying
+//    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
+//
+
+#include <new>
+#include <vector>
+#include <sstream>
+#include <boost/date_time/posix_time/posix_time.hpp>
+#include <boost/bind.hpp>
+#include <boost/lexical_cast.hpp>
+
+#include "./parameter_stub/parameter.h"
+#include "virtualservice.h"
+#include "logger_enum.h"
+#include "logger.h"
+
+l7vs::virtual_service::virtual_service(    const l7vs::l7vsd& invsd,
+                                        const l7vs::replication& inrep,
+                                        const l7vs::virtualservice_element& inelement ){
+    if( inelement.udpmode )
+        vs = boost::shared_ptr<l7vs::virtualservice_base>(
+                dynamic_cast<l7vs::virtualservice_base*>( new l7vs::virtualservice_udp( invsd, inrep, inelement ) ) );
+    else
+        vs = boost::shared_ptr<l7vs::virtualservice_base>(
+                dynamic_cast<l7vs::virtualservice_base*>( new l7vs::virtualservice_tcp( invsd, inrep, inelement ) ) );
+}
+
+l7vs::virtual_service::~virtual_service(){
+}
+
+void    l7vs::virtual_service::initialize( l7vs::error_code& err ){
+    if( NULL != vs )
+        vs->initialize( err );
+    else{
+        err.setter( false, "Fail, create VirtualService" );
+    }
+}
+void    l7vs::virtual_service::finalize( l7vs::error_code& err ){
+    vs->finalize( err );
+}
+
+bool    l7vs::virtual_service::operator==( const l7vs::virtualservice_base& in ){
+    return vs->operator==( in );
+}
+bool    l7vs::virtual_service::operator!=( const l7vs::virtualservice_base& in ){
+    return vs->operator!=( in );
+}
+
+void    l7vs::virtual_service::set_virtualservice( const l7vs::virtualservice_element& in, l7vs::error_code& err ){
+    vs->set_virtualservice( in, err );
+}
+void    l7vs::virtual_service::edit_virtualservice( const l7vs::virtualservice_element& in, l7vs::error_code& err ){
+    vs->edit_virtualservice( in, err );
+}
+
+void    l7vs::virtual_service::add_realserver( const l7vs::virtualservice_element& in, l7vs::error_code& err ){
+    vs->add_realserver( in, err );
+}
+void    l7vs::virtual_service::edit_realserver( const l7vs::virtualservice_element& in, l7vs::error_code& err ){
+    vs->edit_realserver( in, err );
+}
+void    l7vs::virtual_service::del_realserver( const l7vs::virtualservice_element& in, l7vs::error_code& err ){
+    vs->del_realserver( in, err );
+}
+
+l7vs::virtualservice_element&    l7vs::virtual_service::get_element(){
+    return vs->get_element();
+}
+
+void        l7vs::virtual_service::run(){
+    vs->run();
+}
+void        l7vs::virtual_service::stop(){
+    vs->stop();
+}
+
+void        l7vs::virtual_service::connection_active( const boost::asio::ip::tcp::endpoint& in ){
+    vs->connection_active( in );
+}
+void        l7vs::virtual_service::connection_inactive( const boost::asio::ip::tcp::endpoint& in ){
+    vs->connection_inactive( in );
+}
+void        l7vs::virtual_service::release_session( const tcp_session* session_ptr ){
+    vs->release_session( session_ptr );
+}
+
+unsigned long long        l7vs::virtual_service::get_qos_upstream(){
+    return vs->get_qos_upstream();
+}
+unsigned long long        l7vs::virtual_service::get_qos_downstream(){
+    return vs->get_qos_downstream();
+}
+unsigned long long        l7vs::virtual_service::get_throughput_upstream(){
+    return vs->get_throughput_upstream();
+}
+unsigned long long        l7vs::virtual_service::get_throughput_downstream(){
+    return vs->get_throughput_downstream();
+}
+
+unsigned long long        l7vs::virtual_service::get_up_recv_size(){
+    return vs->get_up_recv_size();
+}
+
+unsigned long long        l7vs::virtual_service::get_up_send_size(){
+    return vs->get_up_send_size();
+}
+
+unsigned long long        l7vs::virtual_service::get_down_recv_size(){
+    return vs->get_down_recv_size();
+}
+
+unsigned long long        l7vs::virtual_service::get_down_send_size(){
+    return vs->get_down_send_size();
+}
+
+void        l7vs::virtual_service::update_up_recv_size( unsigned long long    datasize ){
+    vs->update_up_recv_size( datasize );
+}
+void        l7vs::virtual_service::update_up_send_size( unsigned long long    datasize ){
+    vs->update_up_send_size( datasize );
+}
+void        l7vs::virtual_service::update_down_recv_size( unsigned long long    datasize ){
+    vs->update_down_recv_size( datasize );
+}
+void        l7vs::virtual_service::update_down_send_size( unsigned long long    datasize ){
+    vs->update_down_send_size( datasize );
+}
+    
+l7vs::protocol_module_base*
+            l7vs::virtual_service::get_protocol_module(){
+    return vs->get_protocol_module();
+}
+l7vs::schedule_module_base*
+            l7vs::virtual_service::get_schedule_module(){
+    return vs->get_schedule_module();
+}
diff --git a/l7vsd/unit_tests/virtualservice_test/virtualservice_tcp.cpp b/l7vsd/unit_tests/virtualservice_test/virtualservice_tcp.cpp
new file mode 100644 (file)
index 0000000..b885bf0
--- /dev/null
@@ -0,0 +1,97 @@
+//
+//!    @file    virtualservice.cpp
+//!    @brief    VirtualService class implementations
+//
+//    copyright (c) sdy corporation. 2008
+//    mail: h dot okada at sdy dot co dot jp
+//
+//    Distributed under the Boost Software License, Version 1.0.(See accompanying
+//    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
+//
+
+#include <new>
+#include <vector>
+#include <sstream>
+#include <boost/date_time/posix_time/posix_time.hpp>
+#include <boost/bind.hpp>
+#include <boost/lexical_cast.hpp>
+
+#include "./parameter_stub/parameter.h"
+#include "virtualservice.h"
+#include "logger_enum.h"
+#include "logger.h"
+#include "./parameter_stub/parameter.h"
+
+#define    BPS_DEFAULT_INTERVAL_USEC    500000ULL
+
+// imprementation for virtualservice_tcp
+l7vs::virtualservice_tcp::virtualservice_tcp(    const l7vsd& invsd,
+                                                const replication& inrep,
+                                                const virtualservice_element& inelement )
+                                                 :    virtualservice_base( invsd, inrep, inelement ),
+                                                    acceptor_( dispatcher ),
+                                                    sslcontext(dispatcher, DEFAULT_SSL_METHOD) {}
+
+l7vs::virtualservice_tcp::~virtualservice_tcp(){
+}
+
+void    l7vs::virtualservice_tcp::handle_replication_interrupt( const boost::system::error_code& in ){
+}
+
+void    l7vs::virtualservice_tcp::read_replicationdata(){
+}
+
+void    l7vs::virtualservice_tcp::handle_accept( const l7vs::session_thread_control* stc_ptr, const boost::system::error_code& err ){
+}
+
+void    l7vs::virtualservice_tcp::initialize( l7vs::error_code& err ){
+    err.setter( false, "" );
+}
+
+void        l7vs::virtualservice_tcp::finalize( l7vs::error_code& err ){
+    err.setter( false, "" );
+}
+
+bool    l7vs::virtualservice_tcp::operator==( const l7vs::virtualservice_base& in ){
+    return true;
+}
+
+bool    l7vs::virtualservice_tcp::operator!=( const l7vs::virtualservice_base& in ){
+    return true;
+}
+
+void    l7vs::virtualservice_tcp::set_virtualservice( const l7vs::virtualservice_element& in, l7vs::error_code& err ){
+    err.setter( false, "" );
+}
+
+void    l7vs::virtualservice_tcp::edit_virtualservice( const l7vs::virtualservice_element& in, l7vs::error_code& err ){
+    err.setter( false, "" );
+}
+
+void    l7vs::virtualservice_tcp::add_realserver( const l7vs::virtualservice_element& in, l7vs::error_code& err ){
+    err.setter( false, "" );
+}
+
+void    l7vs::virtualservice_tcp::edit_realserver( const l7vs::virtualservice_element& in, l7vs::error_code& err ){
+    err.setter( false, "" );
+}
+
+void    l7vs::virtualservice_tcp::del_realserver( const l7vs::virtualservice_element& in, l7vs::error_code& err ){
+    err.setter( false, "" );
+}
+
+void    l7vs::virtualservice_tcp::run(){
+}
+
+void    l7vs::virtualservice_tcp::stop(){
+}
+
+void    l7vs::virtualservice_tcp::connection_active( const boost::asio::ip::tcp::endpoint& in ){
+}
+
+void    l7vs::virtualservice_tcp::connection_inactive( const boost::asio::ip::tcp::endpoint& in ){
+}
+
+void    l7vs::virtualservice_tcp::release_session( const tcp_session* session_ptr ){
+}
+
diff --git a/l7vsd/unit_tests/virtualservice_test/virtualservice_udp.cpp b/l7vsd/unit_tests/virtualservice_test/virtualservice_udp.cpp
new file mode 100644 (file)
index 0000000..586c3ae
--- /dev/null
@@ -0,0 +1,75 @@
+//
+//!    @file    virtualservice.cpp
+//!    @brief    VirtualService class implementations
+//
+//    copyright (c) sdy corporation. 2008
+//    mail: h dot okada at sdy dot co dot jp
+//
+//    Distributed under the Boost Software License, Version 1.0.(See accompanying
+//    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
+//
+
+#include <new>
+#include <vector>
+#include <sstream>
+#include <boost/date_time/posix_time/posix_time.hpp>
+#include <boost/bind.hpp>
+#include <boost/lexical_cast.hpp>
+
+#include "virtualservice.h"
+#include "logger_enum.h"
+#include "logger.h"
+#include "parameter.h"
+
+#define    BPS_DEFAULT_INTERVAL_USEC    500000ULL
+
+// imprementation for virtualservice_udp
+/*!
+ * virtualservice_udp class constructor.
+ */
+l7vs::virtualservice_udp::virtualservice_udp(    const l7vs::l7vsd& invsd,
+                                                const l7vs::replication& inrep,
+                                                const l7vs::virtualservice_element& inelement) : 
+                                                    l7vs::virtualservice_base( invsd, inrep, inelement ){}
+l7vs::virtualservice_udp::~virtualservice_udp(){}
+
+void    l7vs::virtualservice_udp::handle_replication_interrupt( const boost::system::error_code& in ){
+}
+void    l7vs::virtualservice_udp::read_replicationdata(){
+}
+
+void    l7vs::virtualservice_udp::initialize( l7vs::error_code& err ){
+    err.setter( true, "" );
+}
+void    l7vs::virtualservice_udp::finalize( l7vs::error_code& err ){
+    err.setter( true, "" );
+}
+
+bool    l7vs::virtualservice_udp::operator==( const l7vs::virtualservice_base& in ){
+    return true;
+}
+bool    l7vs::virtualservice_udp::operator!=( const l7vs::virtualservice_base& in ){
+    return true;
+}
+
+void    l7vs::virtualservice_udp::set_virtualservice( const l7vs::virtualservice_element& in, l7vs::error_code& err ){
+    err.setter( true, "" );
+}
+void    l7vs::virtualservice_udp::edit_virtualservice( const l7vs::virtualservice_element& in, l7vs::error_code& err ){
+    err.setter( true, "" );
+}
+
+void    l7vs::virtualservice_udp::add_realserver( const l7vs::virtualservice_element& in, l7vs::error_code& err ){
+    err.setter( true, "" );
+}
+void    l7vs::virtualservice_udp::edit_realserver( const l7vs::virtualservice_element& in, l7vs::error_code& err ){
+    err.setter( true, "" );
+}
+void    l7vs::virtualservice_udp::del_realserver( const l7vs::virtualservice_element& in, l7vs::error_code& err ){
+    err.setter( true, "" );
+}
+
+void    l7vs::virtualservice_udp::run(){}
+void    l7vs::virtualservice_udp::stop(){}
+
+void    l7vs::virtualservice_udp::release_session( const tcp_session* session_ptr ){}
diff --git a/l7vsd/unit_tests/virtualservice_test/vs_base_test.cpp b/l7vsd/unit_tests/virtualservice_test/vs_base_test.cpp
new file mode 100644 (file)
index 0000000..fffd076
--- /dev/null
@@ -0,0 +1,230 @@
+
+#include <iostream>
+#include <sstream>
+#include <boost/test/included/unit_test.hpp>
+#include <boost/archive/text_oarchive.hpp>
+#include <boost/archive/text_iarchive.hpp>
+
+#include "stub.h"
+
+#include "vs_test.h"
+#include "virtualservice.h"
+
+#include "protocol_module_test1.h"
+#include "schedule_module_test1.h"
+
+using namespace boost::unit_test;
+
+//test case1.create & destroy
+void    virtualservice_base_test1(){
+    l7vs::l7vsd                    vsd;
+    boost::asio::io_service        dispatcher;
+    l7vs::replication            rep;
+    l7vs::virtualservice_element    element;
+    
+    // unit_test[1]  object create
+    BOOST_MESSAGE( "-------1" );
+    l7vs::vs_test*    vs = new l7vs::vs_test( vsd, rep, element );
+
+    BOOST_CHECK_EQUAL( &vsd, &(vs->get_vsd()) );
+    BOOST_CHECK_EQUAL( &rep, &(vs->get_rep()) );
+    BOOST_CHECK( element == vs->get_element() );
+
+    // unit_test[2]  object destroy
+    BOOST_MESSAGE( "-------2" );
+    delete vs;
+}
+
+//test case2 method call1
+void    virtualservice_base_test2(){
+    l7vs::l7vsd                    vsd;
+    boost::asio::io_service        dispatcher;
+    l7vs::replication            rep;
+    l7vs::virtualservice_element    element;
+    //
+    element.qos_upstream    = 1234ULL;
+    element.qos_downstream    = 5678ULL;
+
+    boost::shared_ptr<l7vs::vs_test>    vs( new l7vs::vs_test( vsd, rep, element ) );
+
+    boost::system::error_code    test_err;
+    l7vs::error_code            vs_err;
+
+    // unit_test[3]  プロトコルモジュールをロードせずにreplication handlerを呼ぶ
+    BOOST_MESSAGE( "-------3" );
+    vs->call_handle_protomod_replication( test_err );
+    // unit_test[4]  プロトコルモジュールをロードせずにget_protocol_moduleを呼ぶ
+    BOOST_MESSAGE( "-------4" );
+    BOOST_CHECK( NULL == vs->get_protocol_module() );
+
+    // unit_test[5]  スケジュールモジュールをロードせずにreplication handlerを呼ぶ
+    BOOST_MESSAGE( "-------5" );
+    vs->call_handle_schedmod_replication( test_err );
+    // unit_test[6]  プロトコルモジュールをロードせずにget_schedule_moduleを呼ぶ
+    BOOST_MESSAGE( "-------6" );
+    BOOST_CHECK( NULL == vs->get_schedule_module() );
+
+    //派生先のinitialize()でモジュールがロードされる
+    vs->initialize( vs_err );
+    // unit_test[7]  プロトコルモジュールをロード後にreplication handlerを呼ぶ
+    BOOST_MESSAGE( "-------7" );
+    vs->call_handle_protomod_replication( test_err );
+    // unit_test[8]  プロトコルモジュールをロード後にget_protocol_moduleを呼ぶ
+    BOOST_MESSAGE( "-------8" );
+    BOOST_CHECK( NULL != vs->get_protocol_module() );
+    BOOST_CHECK( "PMtest1" == vs->get_protocol_module()->get_name() );
+
+    // unit_test[9]  スケジュールモジュールをロード後にreplication handlerを呼ぶ
+    BOOST_MESSAGE( "-------9" );
+    vs->call_handle_schedmod_replication( test_err );
+    // unit_test[10]  スケジュールモジュールをロード後にget_schedule_moduleを呼ぶ
+    BOOST_MESSAGE( "-------10" );
+    BOOST_CHECK( NULL != vs->get_schedule_module() );
+    BOOST_CHECK( "SMtest1" == vs->get_schedule_module()->get_name() );
+
+    // unit_test[11]  rs_list_lockメソッドを呼ぶと、参照カウントがカウントアップされることを確認
+    BOOST_MESSAGE( "-------11" );
+    vs->rs_list_lock();
+    BOOST_CHECK( 1 == vs->get_refcount() );
+    // unit_test[12]  rs_list_unlockメソッドを呼ぶと、参照カウントがカウントダウンされることを確認
+    BOOST_MESSAGE( "-------12" );
+    vs->rs_list_unlock();
+    BOOST_CHECK( 0 == vs->get_refcount() );
+
+    // unit_test[13]  rs_list_lockメソッド上限境界値(ULLONG_MAX + 1)
+    BOOST_MESSAGE( "-------13" );
+    vs->set_refcount( ULLONG_MAX );
+    vs->rs_list_lock();
+    std::cout << vs->get_refcount() << std::endl;
+    BOOST_CHECK( 0ULL == vs->get_refcount() );
+
+    // unit_test[14]  rs_list_lockメソッド下限境界値(ULLONG_MIN(=0) - 1)
+    BOOST_MESSAGE( "-------14" );
+    vs->set_refcount( 0 );
+    vs->rs_list_unlock();
+    std::cout << vs->get_refcount() << std::endl;
+    BOOST_CHECK( ULLONG_MAX == vs->get_refcount() );
+
+    // unit_test[15]  get_qos_upstreamメソッド(element.qos_upstreamと同じ値であることを確認)
+    BOOST_MESSAGE( "-------15" );
+    BOOST_CHECK( 1234ULL == vs->get_qos_upstream() );
+    // unit_test[16]  get_qos_downstreamメソッド(element.qos_downstreamと同じ値であることを確認)
+    BOOST_MESSAGE( "-------16" );
+    BOOST_CHECK( 5678ULL == vs->get_qos_downstream() );
+
+    // unit_test[17]  update_up_recv_sizeメソッド(Updateされることを確認)
+    BOOST_MESSAGE( "-------17" );
+    vs->update_up_recv_size( 12ULL );
+    // unit_test[18]  get_up_recv_sizeメソッドで上り総受信サイズを取得
+    BOOST_MESSAGE( "-------18" );
+    BOOST_CHECK( 12ULL == vs->get_up_recv_size() );
+    BOOST_MESSAGE( "up recv size : " << vs->get_up_recv_size() );
+    // unit_test[19]  update_up_recv_sizeメソッド(以前の値に加算されることを確認)
+    BOOST_MESSAGE( "-------18" );
+    vs->update_up_recv_size( 28ULL );
+    BOOST_CHECK( 40ULL == vs->get_up_recv_size() );
+    BOOST_MESSAGE( "up recv size : " << vs->get_up_recv_size() );
+    // unit_test[20]  update_up_recv_sizeメソッド上限境界値(加算するとULLONG_MAXを越える場合)
+    BOOST_MESSAGE( "-------20" );
+    vs->update_up_recv_size( ULLONG_MAX );
+    BOOST_CHECK( 39ULL == vs->get_up_recv_size() );
+    BOOST_MESSAGE( "up recv size : " << vs->get_up_recv_size() );
+
+    // unit_test[21]  update_up_send_sizeメソッド(Updateされることを確認)
+    BOOST_MESSAGE( "-------21" );
+    vs->update_up_send_size( 1024ULL );
+    // unit_test[22]  get_up_send_sizeメソッドで上り総送信サイズを取得
+    BOOST_MESSAGE( "-------22" );
+    BOOST_CHECK( 1024ULL == vs->get_up_send_size() );
+    BOOST_MESSAGE( "up send size : " << vs->get_up_send_size() );
+    // unit_test[23]  update_up_send_sizeメソッド(以前の値に加算されることを確認)
+    BOOST_MESSAGE( "-------23" );
+    vs->update_up_send_size( 2048ULL );
+    BOOST_CHECK( 3072ULL == vs->get_up_send_size() );
+    BOOST_MESSAGE( "up send size : " << vs->get_up_send_size() );
+    // unit_test[24]  update_up_send_sizeメソッド上限境界値(加算するとULLONG_MAXを越える場合)
+    BOOST_MESSAGE( "-------24" );
+    vs->update_up_send_size( ULLONG_MAX );
+    BOOST_CHECK( 3071ULL == vs->get_up_send_size() );
+    BOOST_MESSAGE( "up send size : " << vs->get_up_send_size() );
+
+    // unit_test[25]  update_down_recv_sizeメソッド(Updateされることを確認)
+    BOOST_MESSAGE( "-------25" );
+    vs->update_down_recv_size( 101010ULL );
+    // unit_test[26]  get_down_recv_sizeメソッドで下り総受信サイズを取得
+    BOOST_MESSAGE( "-------26" );
+    BOOST_CHECK( 101010ULL == vs->get_down_recv_size() );
+    BOOST_MESSAGE( "down recv size : " << vs->get_down_recv_size() );
+    // unit_test[27]  update_down_recv_sizeメソッド(以前の値に加算されることを確認)
+    BOOST_MESSAGE( "-------27" );
+    vs->update_down_recv_size( 505050ULL );
+    BOOST_CHECK( 606060ULL == vs->get_down_recv_size() );
+    BOOST_MESSAGE( "down recv size : " << vs->get_down_recv_size() );
+    // unit_test[28]  update_down_recv_sizeメソッド上限境界値(加算するとULLONG_MAXを越える場合)
+    BOOST_MESSAGE( "-------28" );
+    vs->update_down_recv_size( ULLONG_MAX );
+    BOOST_CHECK( 606059ULL == vs->get_down_recv_size() );
+    BOOST_MESSAGE( "down recv size : " << vs->get_down_recv_size() );
+
+    // unit_test[29]  update_down_send_sizeメソッド(Updateされることを確認)
+    BOOST_MESSAGE( "-------29" );
+    vs->update_down_send_size( 123456789ULL );
+    // unit_test[30]  get_down_send_sizeメソッドで下り総送信サイズを取得
+    BOOST_MESSAGE( "-------30" );
+    BOOST_CHECK( 123456789ULL == vs->get_down_send_size() );
+    BOOST_MESSAGE( "down send size : " << vs->get_down_send_size() );
+    // unit_test[31]  update_down_send_sizeメソッド(以前の値に加算されることを確認)
+    BOOST_MESSAGE( "-------31" );
+    vs->update_down_send_size( 987654321ULL );
+    BOOST_CHECK( 1111111110ULL == vs->get_down_send_size() );
+    BOOST_MESSAGE( "down send size : " << vs->get_down_send_size() );
+    // unit_test[32]  update_down_send_sizeメソッド上限境界値(加算するとULLONG_MAXを越える場合)
+    BOOST_MESSAGE( "-------32" );
+    vs->update_down_send_size( ULLONG_MAX );
+    BOOST_CHECK( 1111111109ULL == vs->get_down_send_size() );
+    BOOST_MESSAGE( "down send size : " << vs->get_down_send_size() );
+
+    // unit_test[33]  スループット計算のテスト
+    BOOST_MESSAGE( "-------33" );
+    //計算(curr_sizeクリアのため)
+    vs->call_handle_throughput_update( test_err );
+    //のぼり受信データサイズ更新
+    vs->update_up_recv_size( 1000000000ULL );
+    vs->update_down_recv_size( 2000000000ULL );
+    //それから計算
+    vs->call_handle_throughput_update( test_err );
+    //コンソールに出して確認
+    // unit_test[34]  get_throughput_upstreamメソッドで値を取得
+    BOOST_MESSAGE( "-------34" );
+    BOOST_MESSAGE( "bps up   : " << vs->get_throughput_upstream() );
+    // unit_test[35]  get_throughput_downstreamメソッドで値を取得
+    BOOST_MESSAGE( "-------35" );
+    BOOST_MESSAGE( "bps down : " << vs->get_throughput_downstream() );
+
+    // unit_test[36]  load_parameterでパラメータをロードする(パラメータが存在しないケース)
+    BOOST_MESSAGE( "-------36" );
+    debugg_flug_struct::getInstance().param_exist_flag() = false;
+    vs->call_load_parameter();
+    BOOST_CHECK( vs->get_param_data().session_pool_size == l7vs::virtualservice_base::SESSION_POOL_NUM_DEFAULT );
+
+    // unit_test[37]  load_parameterでパラメータをロードする(パラメータが存在するケース)
+    debugg_flug_struct::getInstance().param_exist_flag() = true;
+    vs->call_load_parameter();
+    BOOST_CHECK( vs->get_param_data().session_pool_size == SESSION_POOL_NUM_PARAM );
+
+
+}
+
+test_suite*    init_unit_test_suite( int argc, char* argv[] ){
+
+    // create unit test suite
+    test_suite* ts = BOOST_TEST_SUITE( "virtualservice_base_test" );
+
+    // add test case to test suite
+//    ts->add( BOOST_TEST_CASE( &virtualservice_base_test1 ) );
+    ts->add( BOOST_TEST_CASE( &virtualservice_base_test2 ) );
+
+    framework::master_test_suite().add( ts );
+
+    return 0;
+}
diff --git a/l7vsd/unit_tests/virtualservice_test/vs_tcp.h b/l7vsd/unit_tests/virtualservice_test/vs_tcp.h
new file mode 100644 (file)
index 0000000..803403e
--- /dev/null
@@ -0,0 +1,462 @@
+#ifndef VS_TEST
+#define VS_TEST
+
+#include <boost/serialization/list.hpp>
+#include "./parameter_stub/parameter.h"
+#include "virtualservice.h"
+#include "protocol_module_control.h"
+#include "schedule_module_control.h"
+
+namespace l7vs{
+
+class    vs_tcp : public virtualservice_tcp {
+public:
+    vs_tcp(    const l7vsd&                    in_vsd,
+            const replication&                in_rep,
+            const virtualservice_element&    in_element ) : virtualservice_tcp( in_vsd, in_rep, in_element ){}
+
+    //imprementation for UT
+    const l7vsd&        get_vsd(){ return vsd; }
+    const replication&    get_rep(){ return rep; }
+
+    void    call_handle_replication_interrupt( const boost::system::error_code& in_err ){
+        handle_replication_interrupt( in_err );
+    }
+
+    void    call_read_replicationdata(){
+        read_replicationdata();
+    }
+
+//    void    call_handle_accept(    const session_thread_control_ptr,
+//                                const boost::system::error_code& );
+
+    session_queue_type&    get_pool_sessions(){
+        return    pool_sessions;
+    }
+    session_map_type&    get_active_sessions(){
+        return    active_sessions;
+    }
+    session_map_type&    get_waiting_sessions(){
+        return    waiting_sessions;
+    }
+    unsigned long long    get_sorry_sessions(){
+        return    sorry_count.get();
+    }
+    std::list<realserver>&    get_rs_list(){
+        return rs_list;
+    }
+    void    release_session( const tcp_session* session_ptr ){
+        std::cout << "release_session called." << std::endl;
+        virtualservice_tcp::release_session( session_ptr );
+    }
+    unsigned long long    get_ref_count(){
+        return rs_list_ref_count.get();
+//         return rs_list_ref_count;
+    }
+
+    bool& get_defer_accept_opt(){
+        return defer_accept_opt;
+    };
+    int& get_defer_accept_val(){
+        return defer_accept_val;
+    };
+    l7vs::tcp_socket_option_info& get_set_sock_opt(){
+        return set_sock_opt;
+    };
+    boost::asio::ip::tcp::acceptor& get_acceptor(){
+        return acceptor_;
+    };
+
+    void set_socket_option(){
+        l7vs::virtualservice_tcp::set_socket_option();
+    };
+
+//--------------------
+//--------------------
+// 2009/12/12 test
+//--------------------
+//--------------------
+
+    
+    std::string get_ssl_password()
+    {
+        return l7vs::virtualservice_tcp::get_ssl_password();
+    };
+    
+    int conv_verify_option(std::string in)
+    {
+        return l7vs::virtualservice_tcp::conv_verify_option(in);
+    };
+    
+    long int    conv_ssl_option(std::string in)
+    {
+        return l7vs::virtualservice_tcp::conv_ssl_option(in);
+    };
+    
+    bool        get_ssl_parameter()
+    {
+        return l7vs::virtualservice_tcp::get_ssl_parameter();
+    };
+    
+    bool        set_ssl_config()
+    {
+        return l7vs::virtualservice_tcp::set_ssl_config();
+    };
+
+    // SSL flag
+    bool &get_ssl_virtualservice_mode_flag()
+    {
+        return(ssl_virtualservice_mode_flag);
+    };
+
+    void set_ssl_virtualservice_mode_flag(bool in)
+    {
+        ssl_virtualservice_mode_flag = in;
+    };
+
+    
+    std::string &get_ssl_file_name()
+    {
+        return(ssl_file_name);
+    };
+
+    void set_ssl_file_name(std::string in)
+    {
+        ssl_file_name = in;
+    };
+
+    
+    
+    // SSL context
+    boost::asio::ssl::context &get_sslcontext()
+    {
+        return(sslcontext);
+    };
+/*
+    void set_sslcontext(boost::asio::ssl::context &in)
+    {
+        sslcontext = in;
+    };
+*/
+    
+    
+    // SSL context parameter
+    std::string &get_ca_dir()
+    {
+        return(ca_dir);
+    };
+
+    void set_ca_dir(std::string in)
+    {
+        ca_dir = in;
+    };
+
+
+    
+    std::string &get_ca_file()
+    {
+        return(ca_file);
+    };
+
+    void set_ca_file(std::string in)
+    {
+        ca_file = in;
+    };
+
+
+
+    
+    std::string &get_cert_chain_dir()
+    {
+        return(cert_chain_dir);
+    };
+
+    void set_cert_chain_dir(std::string in)
+    {
+        cert_chain_dir = in;
+    };
+
+
+
+    
+    std::string &get_cert_chain_file()
+    {
+        return(cert_chain_file);
+    };
+
+    void set_cert_chain_file(std::string in)
+    {
+        cert_chain_file = in;
+    };
+
+
+
+    std::string &get_private_key_dir()
+    {
+        return(private_key_dir);
+    };
+
+    void set_private_key_dir(std::string in)
+    {
+        private_key_dir = in;
+    };
+
+
+
+    
+    
+    std::string &get_private_key_file()
+    {
+        return(private_key_file);
+    };
+
+    void set_private_key_file(std::string in)
+    {
+        private_key_file = in;
+    };
+
+
+
+
+    boost::asio::ssl::context::file_format
+                                &get_private_key_filetype()
+    {
+        return(private_key_filetype);
+    };
+
+    
+    void set_private_key_filetype(boost::asio::ssl::context::file_format in)
+    {
+        private_key_filetype = in;
+    };
+
+
+
+                                
+    std::string &get_private_key_passwd_dir()
+    {
+        return(private_key_passwd_dir);
+    };
+
+    void set_private_key_passwd_dir(std::string in)
+    {
+        private_key_passwd_dir = in;
+    };
+
+
+
+    
+    std::string &get_private_key_passwd_file()
+    {
+        return(private_key_passwd_file);
+    };
+
+    void set_private_key_passwd_file(std::string in)
+    {
+        private_key_passwd_file = in;
+    };
+
+
+
+
+    
+    int &get_verify_options()
+    {
+        return(verify_options);
+    };
+
+    void set_verify_options(int in)
+    {
+        verify_options = in;
+    };
+
+
+
+    
+    int &get_verify_cert_depth()
+    {
+        return(verify_cert_depth);
+    };
+
+    void set_verify_cert_depth(int in)
+    {
+        verify_cert_depth = in;
+    };
+
+
+
+    
+    long int &get_ssl_options()
+    {
+        return(ssl_options);
+    };
+
+    void set_ssl_options(long int in)
+    {
+        ssl_options = in;
+    };
+
+
+    
+    
+    bool &get_is_tmp_dh_use()
+    {
+        return(is_tmp_dh_use);
+    };
+
+    void set_is_tmp_dh_use(bool in)
+    {
+        is_tmp_dh_use = in;
+    };
+
+
+
+    
+    std::string &get_tmp_dh_dir()
+    {
+        return(tmp_dh_dir);
+    };
+
+    void set_tmp_dh_dir(std::string in)
+    {
+        tmp_dh_dir = in;
+    };
+
+
+    
+    
+    std::string &get_tmp_dh_file()
+    {
+        return(tmp_dh_file);
+    };
+
+    void set_tmp_dh_file(std::string in)
+    {
+        tmp_dh_file = in;
+    };
+
+
+    
+    
+    std::string &get_cipher_list()
+    {
+        return(cipher_list);
+    };
+
+    void set_cipher_list(std::string in)
+    {
+        cipher_list = in;
+    };
+
+
+    
+    
+    // SSL session cache parameter
+    bool &get_is_session_cache_use()
+    {
+        return(is_session_cache_use);
+    };
+
+    void set_is_session_cache_use(bool in)
+    {
+        is_session_cache_use = in;
+    };
+
+
+
+    
+    long &get_session_cache_mode()
+    {
+        return(session_cache_mode);
+    };
+
+    void set_session_cache_mode(long in)
+    {
+        session_cache_mode = in;
+    };
+
+
+
+
+    long &get_session_cache_size()
+    {
+        return(session_cache_size);
+    };
+
+    void set_session_cache_size(long in)
+    {
+        session_cache_size = in;
+    };
+
+
+
+    
+    
+    long &get_session_cache_timeout()
+    {
+        return(session_cache_timeout);
+    };
+
+    void set_session_cache_timeout(long in)
+    {
+        session_cache_timeout = in;
+    };
+
+
+
+    
+    // SSL handshake timer parameter
+    int &get_handshake_timeout()
+    {
+        return(handshake_timeout);
+    };
+
+    void set_handshake_timeout(int in)
+    {
+        handshake_timeout = in;
+    };
+
+
+    
+    
+    std::string &get_access_log_file_name()
+    {
+        return(access_log_file_name);
+    };
+
+    void set_access_log_file_name(std::string in)
+    {
+        access_log_file_name = in;
+    };
+
+
+    
+    
+    accesslog_argument_map_type &get_access_log_rotate_arguments()
+    {
+        return(access_log_rotate_arguments);
+    };
+
+    void set_access_log_rotate_arguments(accesslog_argument_map_type in)
+    {
+        access_log_rotate_arguments = in;
+    };
+
+
+    
+    
+    bool &get_access_log_flag()
+    {
+        return(access_log_flag);
+    };
+
+    void set_access_log_flag(bool in)
+    {
+        access_log_flag = in;
+    };
+
+};
+
+}
+
+#endif
diff --git a/l7vsd/unit_tests/virtualservice_test/vs_tcp_it_ut.cpp b/l7vsd/unit_tests/virtualservice_test/vs_tcp_it_ut.cpp
new file mode 100644 (file)
index 0000000..515181a
--- /dev/null
@@ -0,0 +1,403 @@
+
+#include <iostream>
+#include <sstream>
+#include <boost/test/included/unit_test.hpp>
+#include <boost/archive/text_oarchive.hpp>
+#include <boost/archive/text_iarchive.hpp>
+
+#include "stub.h"
+#include "virtualservice.h"
+#include "vs_tcp.h"
+
+#include "protocol_module_test1.h"
+#include "schedule_module_test1.h"
+
+using namespace boost::unit_test;
+
+typedef    boost::asio::ip::tcp::endpoint    tcp_ep_type;
+typedef    boost::asio::ip::udp::endpoint    udp_ep_type;
+
+class    client{
+protected:
+    boost::asio::io_service            dispatcher;
+    boost::asio::ip::tcp::socket    sock;
+    boost::system::error_code        err;
+    std::string                        name;
+public:
+    client( std::string in ) : sock( dispatcher ), name( in ) {}
+    ~client(){}
+    void    connect(){
+        sock.connect( tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) ), err );
+        if( err )
+            std::cout << err.message() << std::endl;
+        else
+            std::cout << "connect : " << name << std::endl;
+    }
+    void    disconnect(){
+        sock.close();
+        std::cout << "disconnect : " << name << std::endl;
+    }
+};
+
+void    vs_tcp_test1(){
+    debugg_flug_struct::getInstance().pmcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().smcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().param_exist_flag() = false;
+
+    l7vs::l7vsd                    vsd;
+    boost::asio::io_service        dispatcher;
+    l7vs::replication            rep;
+    l7vs::virtualservice_element    elem1;
+    //set element value
+    elem1.udpmode                    = false;
+    elem1.tcp_accept_endpoint        = tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem1.udp_recv_endpoint        = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem1.realserver_vector.clear();
+    elem1.protocol_module_name    = "PMtest1";
+    elem1.schedule_module_name    = "SMtest1";
+    elem1.protocol_args.clear();
+    elem1.protocol_args.push_back( "testarg" );
+    elem1.protocol_args.push_back( "testarg2" );
+    elem1.sorry_maxconnection        = LLONG_MAX;
+    elem1.sorry_endpoint            = tcp_ep_type( boost::asio::ip::address::from_string( "10.144.169.87" ), (8080) );
+    elem1.sorry_flag                = INT_MAX;
+    elem1.qos_upstream            = 65535ULL;
+    elem1.qos_downstream            = 32767ULL;
+
+    l7vs::vs_tcp*    vs = new l7vs::vs_tcp( vsd, rep, elem1 );
+
+    BOOST_CHECK_EQUAL( &vsd, &(vs->get_vsd()) );
+    BOOST_CHECK_EQUAL( &rep, &(vs->get_rep()) );
+    l7vs::error_code    vs_err;
+    BOOST_CHECK( NULL == vs->get_protocol_module() );
+    BOOST_CHECK( NULL == vs->get_schedule_module() );
+
+    // unit_test[1]  sorry_flag = INT_MAXでVSを作成した場合、sorry_flagが0に設定されること
+    // unit_test[2]  sorry_maxconnection = LLONG_MAXでVSを作成した場合、sorry_maxconnectionが0LLに設定されること
+    BOOST_MESSAGE( "-------1" );
+    BOOST_CHECK( vs->get_element().sorry_maxconnection == 0LL );
+    BOOST_MESSAGE( vs->get_element().sorry_maxconnection );
+    BOOST_MESSAGE( "-------2" );
+    BOOST_CHECK( vs->get_element().sorry_flag == 0 );
+    BOOST_MESSAGE( vs->get_element().sorry_flag );
+
+    vs->initialize( vs_err );
+    BOOST_CHECK( vs_err == false );
+    BOOST_MESSAGE( vs_err.get_message() );
+
+    // unit_test[3]  初期化(不正なIPアドレス指定でエラーが返ること)
+    {
+    BOOST_MESSAGE( "-------3" );
+    l7vs::virtualservice_element    elem2;
+    //set element value
+    elem2.udpmode                    = false;
+    elem2.tcp_accept_endpoint        = tcp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (60000) );
+    elem2.realserver_vector.clear();
+    elem2.protocol_module_name    = "PMtest1";
+    elem2.schedule_module_name    = "SMtest1";
+    elem2.protocol_args.clear();
+    l7vs::vs_tcp*    vs2 = new l7vs::vs_tcp( vsd, rep, elem2 );
+    vs2->initialize( vs_err );
+    BOOST_CHECK( vs_err == true );
+    BOOST_MESSAGE( vs_err.get_message() );
+
+    vs2->finalize( vs_err );
+    delete vs2;
+    }
+    BOOST_MESSAGE( "-------" );
+
+    // unit_test[4]  初期化(重複IPアドレス指定でエラーが返ること)
+    {
+    BOOST_MESSAGE( "-------4" );
+    l7vs::virtualservice_element    elem2;
+    //set element value
+    elem2.udpmode                    = false;
+    elem1.tcp_accept_endpoint        = tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem2.realserver_vector.clear();
+    elem2.protocol_module_name    = "PMtest1";
+    elem2.schedule_module_name    = "SMtest1";
+    elem2.protocol_args.clear();
+    l7vs::vs_tcp*    vs2 = new l7vs::vs_tcp( vsd, rep, elem2 );
+    vs->initialize( vs_err );
+    BOOST_CHECK( vs_err == true );
+    BOOST_MESSAGE( vs_err.get_message() );
+
+    vs2->finalize( vs_err );
+    delete vs2;
+    }
+
+    vs->finalize( vs_err );
+
+    delete vs;
+    BOOST_MESSAGE( "-------" );
+
+}
+
+void    vs_tcp_test2(){
+    l7vs::error_code    vs_err;
+    boost::system::error_code    test_err;
+
+    debugg_flug_struct::getInstance().pmcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().smcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().param_exist_flag() = false;
+    //まず、stubのレプリケーションエリア作成をする
+    debugg_flug_struct::getInstance().create_rep_area();
+
+    std::stringstream    tmp_tcp_ep;
+    std::stringstream    tmp_udp_ep;
+    std::stringstream    tmp_sorry_ep;
+
+    l7vs::l7vsd                    vsd;
+    boost::asio::io_service        dispatcher;
+    l7vs::replication            rep;
+    l7vs::virtualservice_element    elem1;
+    //set element value
+    elem1.udpmode                    = false;
+    elem1.tcp_accept_endpoint        = tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem1.udp_recv_endpoint            = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem1.realserver_vector.clear();
+    elem1.protocol_module_name        = "PMtest1";
+    elem1.schedule_module_name        = "SMtest1";
+    elem1.protocol_args.clear();
+    elem1.protocol_args.push_back( "testarg" );
+    elem1.protocol_args.push_back( "testarg2" );
+    elem1.sorry_maxconnection        = 1234LL;
+    elem1.sorry_endpoint            = tcp_ep_type( boost::asio::ip::address::from_string( "10.144.169.87" ), (8080) );
+    elem1.sorry_flag                = true;
+    elem1.qos_upstream                = 65535ULL;
+    elem1.qos_downstream            = 32767ULL;
+
+    l7vs::vs_tcp*    vs = new l7vs::vs_tcp( vsd, rep, elem1 );
+
+    vs->initialize( vs_err );
+    usleep( 1000 );
+
+    boost::thread    vs_main( &l7vs::vs_tcp::run, vs );
+    usleep( 1000 );
+
+    boost::system::error_code    b_err;
+
+    // unit_test[5]  sorry_flagがINT_MAXの場合、接続時にsorry通知を行わないことを確認する
+    BOOST_MESSAGE( "-------5" );
+    vs->get_element().sorry_flag = INT_MAX;
+
+    boost::asio::io_service    client_dispatcher;
+    boost::asio::ip::tcp::socket    sock( client_dispatcher );
+    std::cout << "connect" << std::endl;
+    sock.connect( tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) ) );
+    usleep( 1000 );
+    BOOST_CHECK( vs->get_element().sorry_flag == INT_MAX );
+
+
+    // unit_test[6]  replicationデータ作成のテスト
+    BOOST_MESSAGE( "-------6" );
+    vs->get_element().sorry_flag = true;
+    vs->call_handle_replication_interrupt( test_err );
+    l7vs::virtualservice_base::replication_header*    rep_head =
+        reinterpret_cast<l7vs::virtualservice_base::replication_header*>( debugg_flug_struct::getInstance().get_rep_area() );
+    //data_numが0になってることを確認
+    BOOST_CHECK( rep_head->data_num == 1 );
+    l7vs::virtualservice_base::replication_data*    rep_data =
+        reinterpret_cast<l7vs::virtualservice_base::replication_data*>( ++rep_head );
+    //udpmode
+    BOOST_CHECK( rep_data->udpmode == false );
+    //tcp_endpoint
+    tmp_tcp_ep << elem1.tcp_accept_endpoint;
+    BOOST_CHECK( 0 == strncmp( rep_data->tcp_endpoint, tmp_tcp_ep.str().c_str(), 47 ) );
+    //udp_endpoint
+    tmp_udp_ep << elem1.udp_recv_endpoint;
+    BOOST_CHECK( 0 == strncmp( rep_data->udp_endpoint, tmp_udp_ep.str().c_str(), 47 ) );
+    //sorry_maxconnection
+    BOOST_CHECK( rep_data->sorry_maxconnection == 1234LL );
+    //sorry_endpoint
+    tmp_sorry_ep << elem1.sorry_endpoint;
+    BOOST_CHECK( 0 == strncmp( rep_data->sorry_endpoint, tmp_sorry_ep.str().c_str(), 47 ) );
+    //sorry_flag
+    BOOST_CHECK( rep_data->sorry_flag == true );
+    //qos_up
+    BOOST_CHECK( rep_data->qos_up == elem1.qos_upstream );
+    //qos_down
+    BOOST_CHECK( rep_data->qos_down == elem1.qos_downstream );
+    BOOST_MESSAGE( "-------" );
+
+    // unit_test[7]  sorry_flagのクリア
+    // unit_test[8]  sorry_maxconnectionのクリア
+    l7vs::virtualservice_element    elem2;
+    //set element value
+    elem2.udpmode                    = false;
+    elem2.tcp_accept_endpoint        = tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem2.udp_recv_endpoint            = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem2.realserver_vector.clear();
+    elem2.protocol_module_name        = "PMtest1";
+    elem2.schedule_module_name        = "SMtest1";
+    elem2.protocol_args.clear();
+    elem2.protocol_args.push_back( "testarg" );
+    elem2.protocol_args.push_back( "testarg2" );
+    elem2.sorry_maxconnection        = LLONG_MAX;
+    elem2.sorry_endpoint            = tcp_ep_type();
+    elem2.sorry_flag                = INT_MAX;
+    elem2.qos_upstream                = 0ULL;
+    elem2.qos_downstream            = 0ULL;
+
+    BOOST_MESSAGE( "-------7" );
+    vs->edit_virtualservice( elem2, vs_err );
+    BOOST_CHECK( vs_err == false );
+    BOOST_MESSAGE( vs_err.get_message() );
+
+    BOOST_CHECK( vs->get_element().sorry_maxconnection == 0LL );
+    BOOST_MESSAGE( vs->get_element().sorry_maxconnection );
+    BOOST_MESSAGE( "-------8" );
+    BOOST_CHECK( vs->get_element().sorry_flag == 0 );
+    BOOST_MESSAGE( vs->get_element().sorry_flag );
+    BOOST_MESSAGE( "-------" );
+
+    //設定をもとにもどす
+    vs->edit_virtualservice( elem1, vs_err );
+
+    // unit_test[9]  sorry_serverのクリア
+    elem2.sorry_maxconnection        = 1234LL;
+    elem2.sorry_endpoint            = tcp_ep_type( boost::asio::ip::address::from_string( "255.255.255.255" ), (0) );
+    elem2.sorry_flag                = true;
+    BOOST_MESSAGE( "-------9" );
+    vs->edit_virtualservice( elem2, vs_err );
+    BOOST_CHECK( vs->get_element().sorry_endpoint == tcp_ep_type( boost::asio::ip::address::from_string( "0.0.0.0" ), (0) ) );
+    BOOST_MESSAGE( vs->get_element().sorry_endpoint );
+    BOOST_CHECK( vs->get_element().sorry_maxconnection == 0LL );
+    BOOST_MESSAGE( vs->get_element().sorry_maxconnection );
+    BOOST_CHECK( vs->get_element().sorry_flag == 0 );
+    BOOST_MESSAGE( vs->get_element().sorry_flag );
+    BOOST_MESSAGE( "-------" );
+
+    //設定をもとにもどす
+    vs->edit_virtualservice( elem1, vs_err );
+
+    // unit_test[10]  sorry_endpointを変更しない
+    // unit_test[11]  sorry_flagを変更しない
+    // unit_test[12]  sorry_maxconnectionを変更しない
+    elem2.sorry_maxconnection        = 0LL;
+    elem2.sorry_endpoint            = tcp_ep_type();
+    elem2.sorry_flag                = 0;
+    BOOST_MESSAGE( "-------10" );
+    vs->edit_virtualservice( elem2, vs_err );
+    BOOST_CHECK( vs->get_element().sorry_endpoint == elem1.sorry_endpoint );
+    BOOST_MESSAGE( vs->get_element().sorry_endpoint );
+    BOOST_MESSAGE( "-------11" );
+    BOOST_CHECK( vs->get_element().sorry_maxconnection == elem1.sorry_maxconnection );
+    BOOST_MESSAGE( vs->get_element().sorry_maxconnection );
+    BOOST_MESSAGE( "-------12" );
+    BOOST_CHECK( vs->get_element().sorry_flag == elem1.sorry_flag );
+    BOOST_MESSAGE( vs->get_element().sorry_flag );
+    BOOST_MESSAGE( "-------" );
+
+    //設定をもとにもどす
+    vs->edit_virtualservice( elem1, vs_err );
+
+    // unit_test[13]  普通に値が変わるか
+    elem2.sorry_maxconnection        = 2468LL;
+    elem2.sorry_endpoint            = tcp_ep_type( boost::asio::ip::address::from_string( "192.168.0.101" ), (43210) );
+    elem2.qos_upstream                = 32767ULL;
+    elem2.qos_downstream            = 65535ULL;
+    BOOST_MESSAGE( "-------13" );
+    vs->edit_virtualservice( elem2, vs_err );
+    BOOST_CHECK( vs->get_element().sorry_endpoint == elem2.sorry_endpoint );
+    BOOST_MESSAGE( vs->get_element().sorry_endpoint );
+    BOOST_CHECK( vs->get_element().sorry_maxconnection == elem2.sorry_maxconnection );
+    BOOST_MESSAGE( vs->get_element().sorry_maxconnection );
+    BOOST_CHECK( vs->get_element().qos_upstream == elem2.qos_upstream );
+    BOOST_MESSAGE( vs->get_element().qos_upstream );
+    BOOST_CHECK( vs->get_element().qos_downstream == elem2.qos_downstream );
+    BOOST_MESSAGE( vs->get_element().qos_downstream );
+    BOOST_MESSAGE( "-------" );
+
+
+//     BOOST_MESSAGE( "-------14" );
+    sock.close();
+
+    vs->stop();
+    usleep( 1000 );
+
+    vs->finalize( vs_err );
+
+    delete vs;
+
+    //テストが終わったらStubのレプリケーションエリアを削除
+    debugg_flug_struct::getInstance().create_rep_area();
+}
+
+void    vs_tcp_test3(){
+    l7vs::error_code    vs_err;
+    boost::system::error_code    test_err;
+
+    debugg_flug_struct::getInstance().pmcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().smcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().param_exist_flag() = false;
+
+    l7vs::l7vsd                    vsd;
+    boost::asio::io_service        dispatcher;
+    l7vs::replication            rep;
+    l7vs::virtualservice_element    elem1;
+    //set element value
+    elem1.udpmode                    = false;
+    elem1.tcp_accept_endpoint        = tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem1.udp_recv_endpoint            = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem1.realserver_vector.clear();
+    elem1.protocol_module_name        = "PMtest1";
+    elem1.schedule_module_name        = "SMtest1";
+    elem1.protocol_args.clear();
+    elem1.protocol_args.push_back( "testarg" );
+    elem1.protocol_args.push_back( "testarg2" );
+    elem1.sorry_maxconnection        = 2LL;
+    elem1.sorry_endpoint            = tcp_ep_type( boost::asio::ip::address::from_string( "10.144.169.87" ), (8080) );
+    elem1.sorry_flag                = false;
+    elem1.qos_upstream                = 0ULL;
+    elem1.qos_downstream            = 0ULL;
+
+    l7vs::vs_tcp*    vs = new l7vs::vs_tcp( vsd, rep, elem1 );
+    vs->initialize( vs_err );
+    usleep( 1000 );
+    boost::thread    vs_main( &l7vs::vs_tcp::run, vs );
+    usleep( 1000 );
+
+    // unit_test[]  RSに繋がるSession数がsorry_maxconnectionを越えたときに、Sorry状態ONでSessionをスタートすることを確認する
+    BOOST_MESSAGE( "-------" );
+    debugg_flug_struct::getInstance().stub_loglevel() = l7vs::LOG_LV_DEBUG;
+    debugg_flug_struct::getInstance().session_loop_flag() = false;
+    client    cl1("1"),cl2("2"),cl3("3"),cl4("4"),cl5("5");
+    cl1.connect();
+    cl2.connect();
+    cl3.connect();
+    cl4.connect();
+    cl5.connect();
+
+    usleep( 200 );
+    cl1.disconnect();
+    cl2.disconnect();
+    cl3.disconnect();
+    cl4.disconnect();
+    cl5.disconnect();
+    usleep( 1000 );
+    BOOST_MESSAGE( "-------" );
+
+    // unit_test[]  RSに繋がるSession数がsorry_maxconenctionを下回ったとき(Sorryへ接続しているSession数はカウントに入れない)、Sorry状態OFFでSessionをスタートすることを確認する
+
+    // unit_test[]  session_pool_sizeを上回った接続数でSessionが増えても、切断されれば元の数に戻ることを確認する
+
+
+    vs->finalize( vs_err );
+    delete vs;
+}
+
+test_suite*    init_unit_test_suite( int argc, char* argv[] ){
+
+    // create unit test suite
+    test_suite* ts = BOOST_TEST_SUITE( "virtualservice_tcp_test(UT for IT-bug)" );
+
+    // add test case to test suite
+/*    ts->add( BOOST_TEST_CASE( &vs_tcp_test1 ) );
+    ts->add( BOOST_TEST_CASE( &vs_tcp_test2 ) );*/
+    ts->add( BOOST_TEST_CASE( &vs_tcp_test3 ) );
+
+    framework::master_test_suite().add( ts );
+
+    return 0;
+}
diff --git a/l7vsd/unit_tests/virtualservice_test/vs_tcp_test.cpp b/l7vsd/unit_tests/virtualservice_test/vs_tcp_test.cpp
new file mode 100644 (file)
index 0000000..d5cc364
--- /dev/null
@@ -0,0 +1,6299 @@
+
+#include <iostream>
+#include <sstream>
+#include <boost/test/included/unit_test.hpp>
+#include <boost/archive/text_oarchive.hpp>
+#include <boost/archive/text_iarchive.hpp>
+#include <boost/noncopyable.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/asio.hpp>
+#include <boost/thread.hpp>
+
+#include "stub.h"
+#include "./parameter_stub/parameter.h"
+
+
+#include "virtualservice.h"
+#include "vs_tcp.h"
+
+#include "protocol_module_test1.h"
+#include "schedule_module_test1.h"
+
+using namespace boost::unit_test;
+
+typedef    boost::asio::ip::tcp::endpoint    tcp_ep_type;
+typedef    boost::asio::ip::udp::endpoint    udp_ep_type;
+
+
+extern l7vs::session_result_message    result;
+int    counter;
+
+//Acceptテスト用Client
+void    client(){
+    boost::system::error_code    b_err;
+
+    boost::asio::io_service    dispatcher;
+    boost::asio::ip::tcp::socket    sock( dispatcher );
+//    std::cout << "connect" << std::endl;
+    sock.connect( tcp_ep_type( boost::asio::ip::address_v4::loopback() , (60000) ) ,b_err);
+    if(b_err){
+        //ERROR
+        std::cout << "connection error [" << b_err.message() << "]" << std::endl;
+        return;
+    }else{
+        std::cout << "connect" << std::endl;
+    }
+
+    sock.close( b_err );
+}
+
+
+//test case1  create,initialize,run,stop,finalize,destroy(normal case)
+void    virtualservice_tcp_test1(){
+    counter = 1;
+
+    debugg_flug_struct::getInstance().pmcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().smcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().param_exist_flag() = false;
+
+    l7vs::l7vsd                    vsd;
+    boost::asio::io_service        dispatcher;
+    l7vs::replication            rep;
+    l7vs::virtualservice_element    element;
+    //set element value
+    element.udpmode                    = false;
+    element.tcp_accept_endpoint        = tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    element.udp_recv_endpoint        = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    element.realserver_vector.clear();
+    element.protocol_module_name    = "PMtest1";
+    element.schedule_module_name    = "SMtest1";
+    element.protocol_args.clear();
+    element.protocol_args.push_back( "testarg" );
+    element.protocol_args.push_back( "testarg2" );
+    element.sorry_maxconnection        = 1234LL;
+    element.sorry_endpoint            = tcp_ep_type( boost::asio::ip::address::from_string( "10.144.169.87" ), (8080) );
+    element.sorry_flag                = false;
+    element.qos_upstream            = 65535ULL;
+    element.qos_downstream            = 32767ULL;
+   
+    element.ssl_file_name = "";
+    // unit_test[1]  object create
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------1" );
+    l7vs::vs_tcp*    vs = new l7vs::vs_tcp( vsd, rep, element );
+
+    BOOST_CHECK_EQUAL( &vsd, &(vs->get_vsd()) );
+    BOOST_CHECK_EQUAL( &rep, &(vs->get_rep()) );
+    BOOST_CHECK( element == vs->get_element() );
+    l7vs::error_code    vs_err;
+    // unit_test[2]  initialize method call
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------2" );
+    BOOST_CHECK( NULL == vs->get_protocol_module() );
+    BOOST_CHECK( NULL == vs->get_schedule_module() );
+
+    result.flag = false;
+    vs_err.setter(false,"");
+    vs->initialize( vs_err );
+
+    bool result_flg;
+
+    if( vs_err == true ) {
+        result_flg = true;
+    } else if ( vs_err == false ) {
+        result_flg = false;
+    }
+
+    BOOST_CHECK( result_flg == false );
+
+    //protocol_module_controlのモジュールロードを呼んでいるか(モジュールロード正常終了)
+    BOOST_CHECK( NULL != vs->get_protocol_module() );
+    //schedule_module_controlのモジュールロードを呼んでいるか(モジュールロード正常終了)
+    BOOST_CHECK( NULL != vs->get_schedule_module() );
+
+    unsigned int pool_default_size = l7vs::virtualservice_base::SESSION_POOL_NUM_DEFAULT;
+    unsigned int pool_size = vs->get_pool_sessions().size();
+
+std::cout << "pool_size = [" << pool_size << "]\n";
+
+    //session_poolを作成しているか(デフォルトサイズで作成)
+    BOOST_CHECK( pool_default_size == pool_size );
+
+    // set option
+    bool& defer_accept_opt = vs->get_defer_accept_opt();
+    defer_accept_opt = true;
+    int& defer_accept_val = vs->get_defer_accept_val();
+    defer_accept_val = 1;
+
+    // unit_test[3]  run method test
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------3" );
+    boost::thread    vs_main( &l7vs::vs_tcp::run, vs );
+
+    usleep( 1500000 );
+    //1秒待って、ProtocolModule/ScheduleModuleのreplication_interruptが呼ばれることを確認
+    //デフォルト設定は500msなので2回
+    BOOST_MESSAGE( debugg_flug_struct::getInstance().get_pm_rep_count() );
+    BOOST_MESSAGE( debugg_flug_struct::getInstance().get_sm_rep_count() );
+    BOOST_CHECK( 2 == debugg_flug_struct::getInstance().get_pm_rep_count() );
+    BOOST_CHECK( 2 == debugg_flug_struct::getInstance().get_sm_rep_count() );
+
+    // unit_test[54]  set TCP_DEFER_ACCEPT test
+    int val = 0;
+    size_t len = sizeof(val);
+    boost::system::error_code ec;
+    boost::asio::detail::socket_ops::getsockopt(vs->get_acceptor().native(),IPPROTO_TCP,TCP_DEFER_ACCEPT,&val,&len,ec);
+    BOOST_CHECK(!ec);
+    BOOST_CHECK(val);
+    
+    // unit_test[4]  stop method test
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------4" );
+    vs->stop();
+    usleep( 1000 );
+
+    // unit_test[5]  release_session method test(run直後はwaiting_sessionsに入っているため、release_sessionではプールに戻らない)
+    std::cout << counter++ << std::endl;
+//     BOOST_MESSAGE( "-------5" );
+//     BOOST_CHECK( vs->get_pool_sessions().size() == (l7vs::virtualservice_base::SESSION_POOL_NUM_DEFAULT-1) );
+//     BOOST_CHECK( vs->get_waiting_sessions().size() == 1 );
+//     BOOST_CHECK( vs->get_active_sessions().size() == 0 );
+//     vs->release_session( vs->get_waiting_sessions().begin()->second->get_upthread_id() );
+//     BOOST_CHECK( vs->get_pool_sessions().size() == static_cast<size_t>( l7vs::virtualservice_base::SESSION_POOL_NUM_DEFAULT) );
+//     BOOST_CHECK( vs->get_active_sessions().size() == 0 );
+//     BOOST_CHECK( vs->get_waiting_sessions().size() == 0 );
+
+    // unit_test[6]  stop method test(call twice)
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------6" );
+    vs->stop();
+
+    vs_main.join();
+
+    // unit_test[7]  finalize method call
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------7" );
+    vs_err.setter(false,"");
+    vs->finalize( vs_err );
+    BOOST_CHECK( vs_err == false );
+
+    // unit_test[8]  finalizeを2回連続で呼んでみる
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------8" );
+    vs_err.setter(false,"");
+    vs->finalize( vs_err );
+    BOOST_CHECK( vs_err == false );
+
+
+    // unit_test[9]  object destroy
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------9" );
+    delete vs;
+}
+
+//test case2 method call
+void    virtualservice_tcp_test2(){
+    l7vs::error_code    vs_err;
+
+    bool result_flg;
+    l7vs::l7vsd                    vsd;
+    boost::asio::io_service        dispatcher;
+    l7vs::replication            rep;
+    l7vs::virtualservice_element    element;
+    //set element value
+
+
+
+    l7vs::vs_tcp*    vs = new l7vs::vs_tcp( vsd, rep, element );
+    // unit_test[10]  initialize method call(poolsize from parameter file:value = 512)
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------10" );
+    debugg_flug_struct::getInstance().param_exist_flag() = true;
+    debugg_flug_struct::getInstance().pmcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().smcontrol_err_flag()    = false;
+    vs_err.setter(false,"");
+    vs->initialize( vs_err );
+    BOOST_CHECK( SESSION_POOL_NUM_PARAM == vs->get_pool_sessions().size() );
+    BOOST_CHECK( vs_err == false );
+    vs->finalize( vs_err );
+    BOOST_CHECK( vs_err == false );
+    delete vs;
+    vs = NULL;
+
+    vs = new l7vs::vs_tcp( vsd, rep, element );
+    // unit_test[11]  initialize method call(procotol_module_control::module_load error case)
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------11" );
+    debugg_flug_struct::getInstance().param_exist_flag() = false;
+    debugg_flug_struct::getInstance().pmcontrol_err_flag()    = true;
+    debugg_flug_struct::getInstance().smcontrol_err_flag()    = false;
+    BOOST_CHECK( NULL == vs->get_protocol_module() );
+    BOOST_CHECK( NULL == vs->get_schedule_module() );
+    vs->initialize( vs_err );
+    BOOST_CHECK( NULL == vs->get_protocol_module() );
+    BOOST_CHECK( NULL == vs->get_schedule_module() );
+    BOOST_CHECK( vs_err == true );
+    BOOST_MESSAGE( vs_err.get_message() );
+    BOOST_CHECK( PROTOMOD_LOAD_ERROR_MSG == vs_err.get_message() );
+
+    vs->finalize( vs_err );
+    delete vs;
+
+    vs = new l7vs::vs_tcp( vsd, rep, element );
+    // unit_test[12]  initialize method call(procotol_module_control::module_load error case)
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------12" );
+    debugg_flug_struct::getInstance().pmcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().smcontrol_err_flag()    = true;
+    BOOST_CHECK( NULL == vs->get_protocol_module() );
+    BOOST_CHECK( NULL == vs->get_schedule_module() );
+    vs->initialize( vs_err );
+    BOOST_CHECK( NULL != vs->get_protocol_module() );
+    BOOST_CHECK( NULL == vs->get_schedule_module() );
+    BOOST_CHECK( vs_err == true );
+    BOOST_MESSAGE( vs_err.get_message() );
+    BOOST_CHECK( SCHEDMOD_LOAD_ERROR_MSG == vs_err.get_message() );
+
+    vs->finalize( vs_err );
+    delete vs;
+
+    vs = new l7vs::vs_tcp( vsd, rep, element );
+    vs->initialize( vs_err );
+    l7vs::vs_tcp*    vs2 = new l7vs::vs_tcp( vsd, rep, element );
+    vs2->initialize( vs_err );
+    // unit_test[13]  initialize method call(procotol_module_control::module_load error case)
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------13" );
+    BOOST_CHECK( *vs == *vs2 );
+    vs->finalize( vs_err );
+    delete vs;
+    vs2->finalize( vs_err );
+    delete vs2;
+
+    // unit_test[14]  initialize method call(procotol_module_control::module_load error case)
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------14" );
+    element.udpmode = false;
+    element.tcp_accept_endpoint    = tcp_ep_type( boost::asio::ip::address::from_string( "192.168.10.10" ), (8080) );
+    vs = new l7vs::vs_tcp( vsd, rep, element );
+    vs->initialize( vs_err );
+
+    element.tcp_accept_endpoint    = tcp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (80) );
+    vs2 = new l7vs::vs_tcp( vsd, rep, element );
+    vs2->initialize( vs_err );
+
+    BOOST_CHECK( *vs != *vs2 );
+    vs->finalize( vs_err );
+    delete vs;
+    vs2->finalize( vs_err );
+    delete vs2;
+
+    element.udpmode = false;
+    element.tcp_accept_endpoint    = tcp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (80) );
+    vs = new l7vs::vs_tcp( vsd, rep, element );
+    vs->initialize( vs_err );
+
+    // unit_test[15]  add_realserver method call
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------15" );
+    l7vs::virtualservice_element    add_element;
+    add_element.udpmode = false;
+    add_element.tcp_accept_endpoint = element.tcp_accept_endpoint;
+    for( unsigned int i = 0; i < 10; ++i ){
+        l7vs::realserver_element    rs_elem;
+        rs_elem.tcp_endpoint = tcp_ep_type( boost::asio::ip::address::from_string( "192.168.10.10" ), (i+8080) );
+        add_element.realserver_vector.push_back( rs_elem );
+    }
+
+    vs_err.setter(false,"");
+    vs->add_realserver( add_element, vs_err );
+    std::list<l7vs::realserver>&    rslist = vs->get_rs_list();
+    //RSの数が10であることを確認
+    BOOST_CHECK( 10 == rslist.size() );
+    //vs_errがfalseであることを確認
+    if( vs_err == true ) {
+        result_flg = true;
+    } else if ( vs_err == false ) {
+        result_flg = false;
+    }
+    BOOST_CHECK( result_flg == false );
+    BOOST_MESSAGE( vs_err.get_message() );
+    BOOST_MESSAGE( element.tcp_accept_endpoint );
+    BOOST_MESSAGE( add_element.tcp_accept_endpoint );
+    //各要素が一致するか確認
+    for( std::list<l7vs::realserver>::iterator    itr = rslist.begin();
+        itr != rslist.end(); ++itr ){
+        for( int i = 0; i <= 10; ++i ){
+            if( 10 <= i )BOOST_ERROR( "error add_realserver : endpoint unmatch" );
+            if( itr->tcp_endpoint == tcp_ep_type( boost::asio::ip::address::from_string( "192.168.10.10" ), (i+8080) ) ){
+                BOOST_CHECK( itr->tcp_endpoint == tcp_ep_type( boost::asio::ip::address::from_string( "192.168.10.10" ), (i+8080) ) );
+                break;
+            }
+        }
+    }
+
+    // unit_test[16]  add_realserver method call(VSのEndpointが違う場合はエラーが返ること)
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------16" );
+    l7vs::virtualservice_element    add_err_element;
+    add_err_element.tcp_accept_endpoint = tcp_ep_type( boost::asio::ip::address_v4::loopback(), (80) );
+    l7vs::realserver_element        rs_adderr_elem;
+    rs_adderr_elem.tcp_endpoint = tcp_ep_type( boost::asio::ip::address::from_string( "192.168.100.10" ), (8080) );
+    add_err_element.realserver_vector.push_back( rs_adderr_elem );
+    vs->add_realserver( add_err_element, vs_err );
+    //RSの数が10のままであることを確認
+    BOOST_CHECK( 10 == rslist.size() );
+    //vs_errがtrueでメッセージが存在することを確認
+    BOOST_CHECK( vs_err == true );
+    BOOST_MESSAGE( vs_err.get_message() );
+
+    // unit_test[17]  add_realserver method call(既にあるRS(エンドポイントが同じ)追加はエラーが返ること)
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------17" );
+    add_err_element.tcp_accept_endpoint = tcp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (80) );
+    rs_adderr_elem.tcp_endpoint = tcp_ep_type( boost::asio::ip::address::from_string( "192.168.10.10" ), (8080) );
+    add_err_element.realserver_vector.clear();
+    add_err_element.realserver_vector.push_back( rs_adderr_elem );
+    vs->add_realserver( add_err_element, vs_err );
+    //RSの数が10のままであることを確認
+    BOOST_CHECK( 10 == rslist.size() );
+    //vs_errがtrueでメッセージが存在することを確認
+    BOOST_CHECK( vs_err == true );
+    BOOST_MESSAGE( vs_err.get_message() );
+
+    // unit_test[18]  del_realserver method call(VSのエンドポイントが異なる場合はエラーが返ること)
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------18" );
+    l7vs::virtualservice_element    del_err_element;
+    l7vs::realserver_element        rs_delerr_elem;
+    del_err_element.tcp_accept_endpoint    = tcp_ep_type( boost::asio::ip::address_v4::loopback(), (80) );
+    rs_delerr_elem.tcp_endpoint = tcp_ep_type( boost::asio::ip::address::from_string( "192.168.10.10" ), (8080) );
+    del_err_element.realserver_vector.clear();
+    del_err_element.realserver_vector.push_back( rs_delerr_elem );
+    vs->del_realserver( del_err_element, vs_err );
+    //RSの数が10のままであることを確認
+    BOOST_CHECK( 10 == rslist.size() );
+    //vs_errがtrueでメッセージが存在することを確認
+    BOOST_CHECK( vs_err == true );
+    BOOST_MESSAGE( vs_err.get_message() );
+
+    // unit_test[19]  del_realserver method call(一致するRSが無い場合はエラーが返ること)
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------19" );
+    del_err_element.tcp_accept_endpoint    = tcp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (80) );
+    rs_delerr_elem.tcp_endpoint = tcp_ep_type( boost::asio::ip::address::from_string( "100.90.80.70" ), (60000) );
+    del_err_element.realserver_vector.clear();
+    del_err_element.realserver_vector.push_back( rs_delerr_elem );
+    vs->del_realserver( del_err_element, vs_err );
+    //RSの数が10のままであることを確認
+    BOOST_CHECK( 10 == rslist.size() );
+    //vs_errがtrueでメッセージが存在することを確認
+    BOOST_CHECK( vs_err == true );
+    BOOST_MESSAGE( vs_err.get_message() );
+
+    // unit_test[20]  del_realserver method call
+    //addしたものと同じものを指定して、全削除されることを確認
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------20" );
+    vs_err.setter(false,"");
+    vs->del_realserver( add_element, vs_err );
+    //RSの数が0であることを確認
+    BOOST_CHECK( 0 == rslist.size() );
+    //vs_errがfalseでメッセージが存在しないことを確認
+    if( vs_err == true ) {
+        result_flg = true;
+    } else if ( vs_err == false ) {
+         result_flg = false;
+    }
+    BOOST_CHECK( result_flg == false );
+    BOOST_MESSAGE( vs_err.get_message() );
+    BOOST_CHECK( vs_err.get_message() == "" );
+
+    // unit_test[21]  add_realserver method call(再度追加)
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------21" );
+    vs_err.setter(false,"");
+    vs->add_realserver( add_element, vs_err );
+    //RSの数が10であることを確認
+    BOOST_CHECK( 10 == rslist.size() );
+    //各要素が一致するか確認
+    for( std::list<l7vs::realserver>::iterator    itr = rslist.begin();
+        itr != rslist.end(); ++itr ){
+        for( int i = 0; i <= 10; ++i ){
+            if( 10 <= i )BOOST_ERROR( "error add_realserver : endpoint unmatch" );
+            if( itr->tcp_endpoint == tcp_ep_type( boost::asio::ip::address::from_string( "192.168.10.10" ), (i+8080) ) ){
+                BOOST_CHECK( itr->tcp_endpoint == tcp_ep_type( boost::asio::ip::address::from_string( "192.168.10.10" ), (i+8080) ) );
+                break;
+            }
+        }
+    }
+
+    // unit_test[22]  connection_active method call
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------22" );
+    tcp_ep_type    ep = tcp_ep_type( boost::asio::ip::address::from_string( "192.168.10.10" ), (8080) );
+    vs->connection_active( ep );
+    for( std::list<l7vs::realserver>::iterator    itr = rslist.begin();
+         itr != rslist.end(); ++itr ){
+        if( itr->tcp_endpoint == ep ){
+            BOOST_CHECK( 1 == itr->get_active() );
+            break;
+        }
+    }
+    // unit_test[23]  connection_inactive method call
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------23" );
+    vs->connection_inactive( ep );
+    for( std::list<l7vs::realserver>::iterator    itr = rslist.begin();
+         itr != rslist.end(); ++itr ){
+        if( itr->tcp_endpoint == ep ){
+            BOOST_CHECK( 0 == itr->get_active() );
+            BOOST_CHECK( 1 == itr->get_inact() );
+            break;
+        }
+    }
+
+    vs_err.setter(false,"");
+    vs->finalize( vs_err );
+    delete vs;
+}
+
+//test case3
+void    virtualservice_tcp_test3(){
+    l7vs::error_code            vs_err;
+    boost::system::error_code    test_err;
+    debugg_flug_struct::getInstance().param_exist_flag() = false;
+    debugg_flug_struct::getInstance().pmcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().smcontrol_err_flag()    = false;
+
+    std::stringstream    tmp_tcp_ep;
+    std::stringstream    tmp_udp_ep;
+    std::stringstream    tmp_sorry_ep;
+
+    l7vs::l7vsd                    vsd;
+    boost::asio::io_service        dispatcher;
+    l7vs::replication            rep;
+    l7vs::virtualservice_element    element;
+    //set element value
+
+    element.udpmode                    = false;
+    element.tcp_accept_endpoint        = tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    element.udp_recv_endpoint        = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    element.realserver_vector.clear();
+    element.protocol_module_name    = "PMtest1";
+    element.schedule_module_name    = "SMtest1";
+    element.protocol_args.clear();
+    element.sorry_maxconnection        = 1234LL;
+    element.sorry_endpoint            = tcp_ep_type( boost::asio::ip::address::from_string( "10.144.169.87" ), (8080) );
+    element.sorry_flag                = false;
+    element.qos_upstream            = 65535ULL;
+    element.qos_downstream            = 32767ULL;
+
+    l7vs::vs_tcp*    vs = new l7vs::vs_tcp( vsd, rep, element );
+    vs_err.setter(false,"");
+    vs->initialize( vs_err );
+    BOOST_CHECK( vs_err == false );
+    BOOST_MESSAGE( vs_err.get_message() );
+
+    // unit_test[24]  replication dataが作成できるか確認(初回作成)
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------24" );
+    //まず、stubのレプリケーションエリア作成をする
+    debugg_flug_struct::getInstance().create_rep_area();
+
+    //レプリケーションデータ作成
+    vs->call_handle_replication_interrupt( test_err );
+
+    l7vs::virtualservice_base::replication_header*    rep_head =
+        reinterpret_cast<l7vs::virtualservice_base::replication_header*>( debugg_flug_struct::getInstance().get_rep_area() );
+    //data_numが1になってることを確認
+    BOOST_CHECK( rep_head->data_num == 1 );
+//    l7vs::virtualservice_base::replication_data*    rep_data =
+//        reinterpret_cast<l7vs::virtualservice_base::replication_data*>( ++rep_head );
+
+    // unit_test[25]  edit_virtualserviceのテスト
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------25" );
+    //変更前の値確認
+    BOOST_CHECK( false == vs->get_element().udpmode );
+    BOOST_CHECK( tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) ) ==  vs->get_element().tcp_accept_endpoint );
+    BOOST_CHECK( udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) ) ==  vs->get_element().udp_recv_endpoint );
+    BOOST_CHECK( "PMtest1" == vs->get_element().protocol_module_name );
+    BOOST_CHECK( "SMtest1" == vs->get_element().schedule_module_name );
+    BOOST_CHECK( 1234LL == vs->get_element().sorry_maxconnection );
+    BOOST_CHECK( tcp_ep_type( boost::asio::ip::address::from_string( "10.144.169.87" ), (8080) ) == vs->get_element().sorry_endpoint );
+    BOOST_CHECK( false == vs->get_element().sorry_flag );
+    BOOST_CHECK( 65535ULL == vs->get_element().qos_upstream );
+    BOOST_CHECK( 32767ULL == vs->get_element().qos_downstream );
+
+    //変更値の設定
+    l7vs::virtualservice_element    elem2;
+    elem2.udpmode                    = false;
+    elem2.tcp_accept_endpoint        = tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem2.udp_recv_endpoint            = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem2.realserver_vector.clear();
+    elem2.protocol_module_name        = "PMtest1";
+    elem2.schedule_module_name        = "SMtest2";
+    elem2.protocol_args.clear();
+    elem2.sorry_maxconnection        = 5678LL;
+    elem2.sorry_endpoint            = tcp_ep_type( boost::asio::ip::address::from_string( "10.144.169.86" ), (80) );
+    elem2.sorry_flag                = true;
+    elem2.qos_upstream                = 1024ULL;
+    elem2.qos_downstream            = 4096ULL;
+
+    debugg_flug_struct::getInstance().pmcontrol_err_flag() = false;
+    debugg_flug_struct::getInstance().smcontrol_err_flag() = false;
+    vs_err.setter(false,"");
+    vs->edit_virtualservice( elem2, vs_err );
+    BOOST_CHECK( vs_err == false );
+    BOOST_MESSAGE( vs_err.get_message() );
+    //変更後の確認
+    BOOST_CHECK( false == vs->get_element().udpmode );
+    BOOST_CHECK( elem2.tcp_accept_endpoint    ==  vs->get_element().tcp_accept_endpoint );
+    BOOST_CHECK( element.udp_recv_endpoint    ==  vs->get_element().udp_recv_endpoint );
+    BOOST_CHECK( "PMtest1" == vs->get_element().protocol_module_name );
+    BOOST_CHECK( "SMtest2" == vs->get_element().schedule_module_name );
+    BOOST_CHECK( 5678LL == vs->get_element().sorry_maxconnection );
+    BOOST_CHECK( elem2.sorry_endpoint == vs->get_element().sorry_endpoint );
+    BOOST_CHECK( true == vs->get_element().sorry_flag );
+    BOOST_CHECK( 1024ULL == vs->get_element().qos_upstream );
+    BOOST_CHECK( 4096ULL == vs->get_element().qos_downstream );
+
+    // unit_test[26]  edit_virtualserviceのテスト(udpmodeが一致しないものはエラーが返る&値が反映されない)
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------26" );
+    l7vs::virtualservice_element    elem3;
+    elem3.udpmode                    = true;
+    elem3.tcp_accept_endpoint        = tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem3.udp_recv_endpoint            = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (40000) );
+    elem3.realserver_vector.clear();
+    elem3.protocol_module_name        = "PMtest1";
+    elem3.schedule_module_name        = "SMtest2";
+    elem3.protocol_args.clear();
+    elem3.sorry_maxconnection        = 65535LL;
+    elem3.sorry_endpoint            = tcp_ep_type( boost::asio::ip::address::from_string( "10.144.169.86" ), (80) );
+    elem3.sorry_flag                = false;
+    elem3.qos_upstream                = 1024ULL;
+    elem3.qos_downstream            = 4096ULL;
+
+    vs_err.setter(false,"");
+    vs->edit_virtualservice( elem3, vs_err );
+    //vs_errがtrueなのをチェック
+    BOOST_CHECK( vs_err == true );
+
+    BOOST_CHECK( false == vs->get_element().udpmode );
+    BOOST_CHECK( elem2.tcp_accept_endpoint    ==  vs->get_element().tcp_accept_endpoint );
+    BOOST_CHECK( element.udp_recv_endpoint    ==  vs->get_element().udp_recv_endpoint );
+    BOOST_CHECK( "PMtest1" == vs->get_element().protocol_module_name );
+    BOOST_CHECK( "SMtest2" == vs->get_element().schedule_module_name );
+    BOOST_CHECK( 5678LL == vs->get_element().sorry_maxconnection );
+    BOOST_CHECK( elem2.sorry_endpoint == vs->get_element().sorry_endpoint );
+    BOOST_CHECK( true == vs->get_element().sorry_flag );
+    BOOST_CHECK( 1024ULL == vs->get_element().qos_upstream );
+    BOOST_CHECK( 4096ULL == vs->get_element().qos_downstream );
+
+    // unit_test[27]  edit_virtualserviceのテスト(tcp_accept_endpointが一致しないものはエラーが返る&値が反映されない)
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------27" );
+    elem3.udpmode                    = false;
+    elem3.tcp_accept_endpoint        = tcp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (8080) );
+    elem3.udp_recv_endpoint            = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (40000) );
+    elem3.protocol_module_name        = "PMtest1";
+
+    vs_err.setter(false,"");
+    vs->edit_virtualservice( elem3, vs_err );
+    //vs_errがtrueなのをチェック
+    BOOST_CHECK( vs_err == true );
+
+    BOOST_CHECK( false == vs->get_element().udpmode );
+    BOOST_CHECK( elem2.tcp_accept_endpoint    ==  vs->get_element().tcp_accept_endpoint );
+    BOOST_CHECK( element.udp_recv_endpoint    ==  vs->get_element().udp_recv_endpoint );
+    BOOST_CHECK( "PMtest1" == vs->get_element().protocol_module_name );
+    BOOST_CHECK( "SMtest2" == vs->get_element().schedule_module_name );
+    BOOST_CHECK( 5678LL == vs->get_element().sorry_maxconnection );
+    BOOST_CHECK( elem2.sorry_endpoint == vs->get_element().sorry_endpoint );
+    BOOST_CHECK( true == vs->get_element().sorry_flag );
+    BOOST_CHECK( 1024ULL == vs->get_element().qos_upstream );
+    BOOST_CHECK( 4096ULL == vs->get_element().qos_downstream );
+
+    // unit_test[28]  edit_virtualserviceのテスト(protocol_module_nameが一致しないものはエラーが返る&値が反映されない)
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------28" );
+    elem3.udpmode                    = false;
+    elem3.tcp_accept_endpoint        = tcp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (60000) );
+    elem3.udp_recv_endpoint            = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (40000) );
+    elem3.protocol_module_name        = "PMtest2";
+
+    vs_err.setter(false,"");
+    vs->edit_virtualservice( elem3, vs_err );
+    //vs_errがtrueなのをチェック
+    BOOST_CHECK( vs_err == true );
+
+    BOOST_CHECK( false == vs->get_element().udpmode );
+    BOOST_CHECK( elem2.tcp_accept_endpoint    ==  vs->get_element().tcp_accept_endpoint );
+    BOOST_CHECK( element.udp_recv_endpoint    ==  vs->get_element().udp_recv_endpoint );
+    BOOST_CHECK( "PMtest1" == vs->get_element().protocol_module_name );
+    BOOST_CHECK( "SMtest2" == vs->get_element().schedule_module_name );
+    BOOST_CHECK( 5678LL == vs->get_element().sorry_maxconnection );
+    BOOST_CHECK( elem2.sorry_endpoint == vs->get_element().sorry_endpoint );
+    BOOST_CHECK( true == vs->get_element().sorry_flag );
+    BOOST_CHECK( 1024ULL == vs->get_element().qos_upstream );
+    BOOST_CHECK( 4096ULL == vs->get_element().qos_downstream );
+
+    // unit_test[29]  edit_virtualserviceのテスト(sorry_endpointの変更無し)
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------29" );
+    elem2.udpmode                    = false;
+    elem2.tcp_accept_endpoint        = tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem2.udp_recv_endpoint            = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (40000) );
+    elem2.realserver_vector.clear();
+    elem2.protocol_module_name        = "PMtest1";
+    elem2.schedule_module_name        = "SMtest2";
+    elem2.protocol_args.clear();
+    elem2.sorry_maxconnection        = 5678LL;
+    elem2.sorry_endpoint            = tcp_ep_type( boost::asio::ip::address::from_string( "0.0.0.0" ), (0) );
+    elem2.sorry_flag                = true;
+    elem2.qos_upstream                = 1024ULL;
+    elem2.qos_downstream            = 4096ULL;
+
+    vs_err.setter(false,"");
+    vs->edit_virtualservice( elem2, vs_err );
+    //vs_errがtrueなのをチェック
+    BOOST_CHECK( vs_err == false );
+
+    BOOST_CHECK( false == vs->get_element().udpmode );
+    BOOST_CHECK( elem2.tcp_accept_endpoint    ==  vs->get_element().tcp_accept_endpoint );
+    BOOST_CHECK( element.udp_recv_endpoint    ==  vs->get_element().udp_recv_endpoint );
+    BOOST_CHECK( "PMtest1" == vs->get_element().protocol_module_name );
+    BOOST_CHECK( "SMtest2" == vs->get_element().schedule_module_name );
+    BOOST_CHECK( 5678LL == vs->get_element().sorry_maxconnection );
+    BOOST_CHECK( tcp_ep_type( boost::asio::ip::address::from_string( "10.144.169.86" ), (80) ) == vs->get_element().sorry_endpoint );
+    BOOST_CHECK( true == vs->get_element().sorry_flag );
+    BOOST_CHECK( 1024ULL == vs->get_element().qos_upstream );
+    BOOST_CHECK( 4096ULL == vs->get_element().qos_downstream );
+
+    // unit_test[30]  edit_virtualserviceのテスト(sorry_endpointクリア)
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------30" );
+    elem2.udpmode                    = false;
+    elem2.tcp_accept_endpoint        = tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem2.udp_recv_endpoint            = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (40000) );
+    elem2.realserver_vector.clear();
+    elem2.protocol_module_name        = "PMtest1";
+    elem2.schedule_module_name        = "SMtest2";
+    elem2.protocol_args.clear();
+    elem2.sorry_maxconnection        = 5678LL;
+    elem2.sorry_endpoint            = tcp_ep_type( boost::asio::ip::address::from_string( "255.255.255.255" ), (0) );
+    elem2.sorry_flag                = true;
+    elem2.qos_upstream                = 1024ULL;
+    elem2.qos_downstream            = 4096ULL;
+
+    vs_err.setter(false,"");
+    vs->edit_virtualservice( elem2, vs_err );
+    //vs_errがtrueなのをチェック
+    BOOST_CHECK( vs_err == false );
+
+    BOOST_CHECK( false == vs->get_element().udpmode );
+    BOOST_CHECK( elem2.tcp_accept_endpoint    ==  vs->get_element().tcp_accept_endpoint );
+    BOOST_CHECK( element.udp_recv_endpoint    ==  vs->get_element().udp_recv_endpoint );
+    BOOST_CHECK( "PMtest1" == vs->get_element().protocol_module_name );
+    BOOST_CHECK( "SMtest2" == vs->get_element().schedule_module_name );
+    BOOST_CHECK( 0LL == vs->get_element().sorry_maxconnection );
+    BOOST_CHECK( tcp_ep_type() == vs->get_element().sorry_endpoint );
+    BOOST_CHECK( false == vs->get_element().sorry_flag );
+    BOOST_CHECK( 1024ULL == vs->get_element().qos_upstream );
+    BOOST_CHECK( 4096ULL == vs->get_element().qos_downstream );
+
+//    // unit_test[31]  replication dataが作成できるか確認(既にあるデータを上書き)
+//    // V2-> V3 時点での機能確認が必要であったが、機能が保証されていない。
+//    // 作業後回し(handle_replication_interrupt)
+//    std::cout << counter++ << std::endl;
+//    BOOST_MESSAGE( "-------31" );
+//    vs->call_handle_replication_interrupt( test_err );
+//    rep_head =    reinterpret_cast<l7vs::virtualservice_base::replication_header*>( debugg_flug_struct::getInstance().get_rep_area() );
+//    //data_numが1になってることを確認
+//    BOOST_CHECK( rep_head->data_num == 1 );
+//    rep_data =    reinterpret_cast<l7vs::virtualservice_base::replication_data*>( ++rep_head );
+//    //udpmode
+//    BOOST_CHECK( rep_data->udpmode == false );
+//    //tcp_endpoint
+//    tmp_tcp_ep.str( "" );
+//    tmp_tcp_ep << elem2.tcp_accept_endpoint;
+//    BOOST_CHECK( 0 == strncmp( rep_data->tcp_endpoint, tmp_tcp_ep.str().c_str(), 47 ) );
+//    //udp_endpoint
+//    tmp_udp_ep.str( "" );
+//    tmp_udp_ep << element.udp_recv_endpoint;
+//    BOOST_CHECK( 0 == strncmp( rep_data->udp_endpoint, tmp_udp_ep.str().c_str(), 47 ) );
+//    //sorry_maxconnection
+//    BOOST_CHECK( rep_data->sorry_maxconnection == 0LL );
+//    //sorry_endpoint
+//    tmp_sorry_ep.str( "" );
+//    tmp_sorry_ep << tcp_ep_type();
+//    BOOST_CHECK( 0 == strncmp( rep_data->sorry_endpoint, tmp_sorry_ep.str().c_str(), 47 ) );
+//    //sorry_flag
+//    BOOST_CHECK( rep_data->sorry_flag == false );
+//    //qos_up
+//    BOOST_CHECK( rep_data->qos_up == 1024ULL );
+//    //qos_down
+//    BOOST_CHECK( rep_data->qos_down == 4096ULL );
+//
+//    // unit_test[32]  vsをもう一つ作って、そこからもレプリケーションデータを作成する
+//    // V2-> V3 時点での機能確認が必要であったが、機能が保証されていない。
+//    // 作業後回し(handle_replication_interrupt)
+//    std::cout << counter++ << std::endl;
+//    BOOST_MESSAGE( "-------32" );
+//    elem3.udpmode                    = false;
+//    elem3.tcp_accept_endpoint        = tcp_ep_type( boost::asio::ip::address_v4::loopback(), (65000) );
+//    elem3.udp_recv_endpoint            = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (40000) );
+//    elem3.realserver_vector.clear();
+//    elem3.protocol_module_name        = "PMtest1";
+//    elem3.schedule_module_name        = "SMtest1";
+//    elem3.protocol_args.clear();
+//    elem3.sorry_maxconnection        = 7890LL;
+//    elem3.sorry_endpoint            = tcp_ep_type( boost::asio::ip::address::from_string( "10.144.169.86" ), (80) );
+//    elem3.sorry_flag                = false;
+//    elem3.qos_upstream                = 14142ULL;
+//    elem3.qos_downstream            = 22362ULL;
+//
+//
+//    l7vs::vs_tcp*    vs2 = new l7vs::vs_tcp( vsd, rep, elem3 );
+//
+//    vs_err.setter(false,"");
+//    vs2->initialize( vs_err );
+//    BOOST_CHECK( vs_err == false );
+//    BOOST_MESSAGE( vs_err.get_message() );
+//
+//    //data_numが2になってることを確認
+//    vs2->call_handle_replication_interrupt( test_err );
+//    rep_head =    reinterpret_cast<l7vs::virtualservice_base::replication_header*>( debugg_flug_struct::getInstance().get_rep_area() );
+//    //data_numが2になってることを確認
+//    BOOST_CHECK( rep_head->data_num == 2 );
+//    rep_data =    reinterpret_cast<l7vs::virtualservice_base::replication_data*>( ++rep_head );
+//    ++rep_data;
+//    //udpmode
+//    BOOST_CHECK( rep_data->udpmode == false );
+//    //tcp_endpoint
+//    tmp_tcp_ep.str( "" );
+//    tmp_tcp_ep << elem3.tcp_accept_endpoint;
+//    BOOST_CHECK( 0 == strncmp( rep_data->tcp_endpoint, tmp_tcp_ep.str().c_str(), 47 ) );
+//    //udp_endpoint
+//    tmp_udp_ep.str( "" );
+//    tmp_udp_ep << elem3.udp_recv_endpoint;
+//    BOOST_CHECK( 0 == strncmp( rep_data->udp_endpoint, tmp_udp_ep.str().c_str(), 47 ) );
+//    //sorry_maxconnection
+//    BOOST_CHECK( rep_data->sorry_maxconnection == 7890LL );
+//    //sorry_endpoint
+//    tmp_sorry_ep.str( "" );
+//    tmp_sorry_ep << elem3.sorry_endpoint;
+//    BOOST_CHECK( 0 == strncmp( rep_data->sorry_endpoint, tmp_sorry_ep.str().c_str(), 47 ) );
+//    //sorry_flag
+//    BOOST_CHECK( rep_data->sorry_flag == false );
+//    //qos_up
+//    BOOST_CHECK( rep_data->qos_up == 14142ULL );
+//    //qos_down
+//    BOOST_CHECK( rep_data->qos_down == 22362ULL );
+//
+//    vs_err.setter(false,"");
+//    //一端削除
+//    vs->finalize( vs_err );
+//    delete vs;
+//
+//    // unit_test[33]  VSを削除したら、レプリケーションデータが読み出せないことを確認
+//    std::cout << counter++ << std::endl;
+//    BOOST_MESSAGE( "-------33" );
+//    vs = new l7vs::vs_tcp( vsd, rep, element );
+//    vs_err.setter(false,"");
+//    vs->initialize( vs_err );
+//
+//    //replication dataの確認
+//    vs->call_handle_replication_interrupt( test_err );
+//    vs2->call_handle_replication_interrupt( test_err );
+//    rep_head =    reinterpret_cast<l7vs::virtualservice_base::replication_header*>( debugg_flug_struct::getInstance().get_rep_area() );
+//    //data_numが2になってることを確認
+//    BOOST_CHECK( rep_head->data_num == 3 );
+//    rep_data =    reinterpret_cast<l7vs::virtualservice_base::replication_data*>( ++rep_head );
+//    //udpmode
+//    BOOST_CHECK( rep_data->udpmode == element.udpmode );
+//    //tcp_endpoint
+//    tmp_tcp_ep.str( "" );
+//    tmp_tcp_ep << element.tcp_accept_endpoint;
+//    BOOST_CHECK( 0 == strncmp( rep_data->tcp_endpoint, tmp_tcp_ep.str().c_str(), 47 ) );
+//    //udp_endpoint
+//    tmp_udp_ep.str( "" );
+//    tmp_udp_ep << element.udp_recv_endpoint;
+//    BOOST_CHECK( 0 == strncmp( rep_data->udp_endpoint, tmp_udp_ep.str().c_str(), 47 ) );
+//    //sorry_maxconnection
+//    BOOST_CHECK( rep_data->sorry_maxconnection == 1234LL );
+//    BOOST_MESSAGE( rep_data->sorry_maxconnection );
+//    //sorry_endpoint
+//    tmp_sorry_ep.str( "" );
+//    tmp_sorry_ep << tcp_ep_type( boost::asio::ip::address::from_string( "10.144.169.87" ), (8080) );
+//    BOOST_CHECK( 0 == strncmp( rep_data->sorry_endpoint, tmp_sorry_ep.str().c_str(), 47 ) );
+//    //sorry_flag
+//    BOOST_CHECK( rep_data->sorry_flag == false );
+//    //qos_up
+//    BOOST_CHECK( rep_data->qos_up == 65535ULL );
+//    //qos_down
+//    BOOST_CHECK( rep_data->qos_down == 32767ULL );
+//
+//    //古いデータの確認
+//    BOOST_MESSAGE( "sorry max_conn : " << vs->get_element().sorry_maxconnection );
+//    BOOST_CHECK( 1234LL == vs->get_element().sorry_maxconnection );
+//    BOOST_MESSAGE( "sorry endpoint : " << vs->get_element().sorry_endpoint );
+//    BOOST_CHECK( tcp_ep_type( boost::asio::ip::address::from_string( "10.144.169.87" ), (8080) ) 
+//                    == vs->get_element().sorry_endpoint );
+//    BOOST_MESSAGE( "sorry flag     : " << vs->get_element().sorry_flag );
+//    BOOST_CHECK( false == vs->get_element().sorry_flag );
+//    BOOST_MESSAGE( "QoS upstream   : " << vs->get_element().qos_upstream );
+//    BOOST_CHECK( 65535ULL == vs->get_element().qos_upstream );
+//    BOOST_MESSAGE( "QoS downstream : " << vs->get_element().qos_downstream );
+//    BOOST_CHECK( 32767ULL == vs->get_element().qos_downstream );
+//
+//
+//    //テストが終わったらStubのレプリケーションエリアを削除
+//    debugg_flug_struct::getInstance().create_rep_area();
+//
+    // unit_test[34]  edit_virtualserviceのテスト(schedule_moduleのロードに失敗するケース:致命的エラー)
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------34" );
+    debugg_flug_struct::getInstance().smcontrol_err_flag() = true;
+    elem2.schedule_module_name        = "SMtest3";
+    vs_err.setter(false,"");
+    vs->edit_virtualservice( elem2, vs_err );
+    //vs_errがtrueなのをチェック
+    BOOST_CHECK( vs_err == true );
+    BOOST_MESSAGE( vs_err.get_message() );
+
+//    vs_err.setter(false,"");
+//    vs2->finalize( vs_err );
+//    delete vs2;
+    vs_err.setter(false,"");
+    vs->finalize( vs_err );
+    delete vs;
+}
+
+//IPv6関係のテスト
+void    virtualservice_tcp_test4(){
+    debugg_flug_struct::getInstance().param_exist_flag() = false;
+    debugg_flug_struct::getInstance().pmcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().smcontrol_err_flag()    = false;
+
+    l7vs::error_code            vs_err;
+    boost::system::error_code    test_err;
+
+    std::stringstream    tmp_tcp_ep;
+    std::stringstream    tmp_udp_ep;
+    std::stringstream    tmp_sorry_ep;
+
+    l7vs::l7vsd                    vsd;
+    boost::asio::io_service        dispatcher;
+    l7vs::replication            rep;
+    l7vs::virtualservice_element    elem1;
+
+    //set element value
+    elem1.udpmode                    = false;
+    elem1.tcp_accept_endpoint        = 
+            tcp_ep_type( boost::asio::ip::address_v6::loopback(), (50000) );
+    elem1.udp_recv_endpoint            = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem1.realserver_vector.clear();
+    elem1.protocol_module_name        = "PMtest1";
+    elem1.schedule_module_name        = "SMtest1";
+    elem1.protocol_args.clear();
+    elem1.sorry_maxconnection        = 1234LL;
+    elem1.sorry_endpoint            = 
+            tcp_ep_type( boost::asio::ip::address::from_string( "AFAF:0E08::8FDE" ), (8080) );
+    elem1.sorry_flag                = false;
+    elem1.qos_upstream                = 65535ULL;
+    elem1.qos_downstream            = 32767ULL;
+
+    // unit_test[35]  IPv6アドレスでVS作成
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------35" );
+    l7vs::vs_tcp*    vs;
+    vs = new l7vs::vs_tcp( vsd, rep, elem1 );
+    vs_err.setter(false,"");
+    vs->initialize( vs_err );
+    BOOST_CHECK( vs_err == false );
+    BOOST_MESSAGE( vs_err.get_message() );
+
+    // unit_test[36]  IPv6アドレスでレプリケーションデータ作成
+    //まず、stubのレプリケーションエリア作成をする
+    debugg_flug_struct::getInstance().create_rep_area();
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------36" );
+    vs->call_handle_replication_interrupt( test_err );
+    l7vs::virtualservice_base::replication_header*    rep_head =    
+        reinterpret_cast<l7vs::virtualservice_base::replication_header*>( debugg_flug_struct::getInstance().get_rep_area() );
+    //data_numが0になってることを確認
+    BOOST_CHECK( rep_head->data_num == 1 );
+    l7vs::virtualservice_base::replication_data*    rep_data =    
+        reinterpret_cast<l7vs::virtualservice_base::replication_data*>( ++rep_head );
+    //udpmode
+    BOOST_CHECK( rep_data->udpmode == false );
+    //tcp_endpoint
+    tmp_tcp_ep.str( "" );
+    tmp_tcp_ep << elem1.tcp_accept_endpoint;
+    BOOST_CHECK( 0 == strncmp( rep_data->tcp_endpoint, tmp_tcp_ep.str().c_str(), 47 ) );
+    //udp_endpoint
+    tmp_udp_ep.str( "" );
+    tmp_udp_ep << elem1.udp_recv_endpoint;
+    BOOST_CHECK( 0 == strncmp( rep_data->udp_endpoint, tmp_udp_ep.str().c_str(), 47 ) );
+    //sorry_maxconnection
+    BOOST_CHECK( rep_data->sorry_maxconnection == elem1.sorry_maxconnection );
+    //sorry_endpoint
+    tmp_sorry_ep.str( "" );
+    tmp_sorry_ep << elem1.sorry_endpoint;
+    BOOST_CHECK( 0 == strncmp( rep_data->sorry_endpoint, tmp_sorry_ep.str().c_str(), 47 ) );
+    //sorry_flag
+    BOOST_CHECK( rep_data->sorry_flag == elem1.sorry_flag );
+    //qos_up
+    BOOST_CHECK( rep_data->qos_up == elem1.qos_upstream );
+    //qos_down
+    BOOST_CHECK( rep_data->qos_down == elem1.qos_downstream );
+
+    //比較用VS作成
+    l7vs::vs_tcp*    vs2 = new l7vs::vs_tcp( vsd, rep, elem1 );
+    bool    chkflg;
+    // unit_test[37]  IPv6アドレスでoperator==のテスト(VSが一致するケース)
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------37" );
+    chkflg = ( *vs == *vs2 );
+    BOOST_CHECK( chkflg );
+    // unit_test[38]  IPv6アドレスでoperator!=のテスト(VSが一致するケース)
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------38" );
+    chkflg = ( *vs != *vs2 );
+    BOOST_CHECK( !chkflg );
+    delete vs2;
+    vs2 = NULL;
+
+    //比較用VS作成
+    //set element-2
+    l7vs::virtualservice_element    elem2;
+    elem2.udpmode                    = false;
+    elem2.tcp_accept_endpoint        = 
+            tcp_ep_type( boost::asio::ip::address_v6::loopback(), (55000) );
+    elem2.udp_recv_endpoint            = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem2.realserver_vector.clear();
+    elem2.protocol_module_name        = "PMtest1";
+    elem2.schedule_module_name        = "SMtest1";
+    elem2.protocol_args.clear();
+    elem2.sorry_maxconnection        = 1234LL;
+    elem2.sorry_endpoint            = 
+            tcp_ep_type( boost::asio::ip::address::from_string( "AFAF:0E08::8FDE" ), (8080) );
+    elem2.sorry_flag                = false;
+    elem2.qos_upstream                = 65535ULL;
+    elem2.qos_downstream            = 32767ULL;
+    vs2 = new l7vs::vs_tcp( vsd, rep, elem2 );
+    // unit_test[39]  IPv6アドレスでoperator==のテスト(VSが一致しないケース)
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------39" );
+    chkflg = ( *vs == *vs2 );
+    BOOST_CHECK( !chkflg );
+    // unit_test[40]  IPv6アドレスでoperator!=のテスト(VSが一致しないケース)
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------40" );
+    chkflg = ( *vs != *vs2 );
+    BOOST_CHECK( chkflg );
+    delete vs2;
+    vs2 = NULL;
+
+    // unit_test[41]  IPv6アドレスでVS編集
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------41" );
+    l7vs::virtualservice_element    elem3;
+    elem3.udpmode                    = false;
+    elem3.tcp_accept_endpoint        = 
+            tcp_ep_type( boost::asio::ip::address_v6::loopback(), (50000) );
+    elem3.udp_recv_endpoint            = 
+            udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem3.realserver_vector.clear();
+    elem3.protocol_module_name        = "PMtest1";
+    elem3.schedule_module_name        = "SMtest1";
+    elem3.protocol_args.clear();
+    elem3.sorry_maxconnection        = 3333LL;
+    elem3.sorry_endpoint            = tcp_ep_type( boost::asio::ip::address::from_string( "255.255.255.255" ), (0) );
+    elem3.sorry_flag                = true;
+    elem3.qos_upstream                = 10ULL;
+    elem3.qos_downstream            = 20ULL;
+
+
+    vs_err.setter(false,"");
+    vs->edit_virtualservice( elem3, vs_err );
+    BOOST_CHECK( vs_err == false );
+    BOOST_MESSAGE( vs_err.get_message() );
+    BOOST_CHECK( vs->get_element().sorry_endpoint == tcp_ep_type() );
+    BOOST_CHECK( vs->get_element().sorry_maxconnection == 0LL );
+    BOOST_CHECK( vs->get_element().sorry_flag == false );
+    BOOST_CHECK( vs->get_element().qos_upstream == elem3.qos_upstream );
+    BOOST_CHECK( vs->get_element().qos_downstream == elem3.qos_downstream );
+
+    // unit_test[42]  IPv6アドレスでレプリケーションデータの読み出し:削除したら作りなおしたデータになること
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------42" );
+
+    vs_err.setter(false,"");
+    //一旦VSを削除
+    vs->finalize( vs_err );
+    delete vs;
+    //elem3でVS作成
+    vs = new l7vs::vs_tcp( vsd, rep, elem3 );
+    BOOST_CHECK( vs_err == false );
+    vs->call_read_replicationdata();
+    BOOST_CHECK( vs->get_element().udpmode == elem3.udpmode );
+    BOOST_CHECK( vs->get_element().tcp_accept_endpoint == elem3.tcp_accept_endpoint );
+    BOOST_CHECK( vs->get_element().udp_recv_endpoint == elem3.udp_recv_endpoint );
+    BOOST_CHECK( vs->get_element().protocol_module_name == elem3.protocol_module_name );
+    BOOST_CHECK( vs->get_element().schedule_module_name == elem3.schedule_module_name );
+    BOOST_CHECK( vs->get_element().sorry_maxconnection == 0LL );
+    BOOST_CHECK( vs->get_element().sorry_endpoint == tcp_ep_type() );
+    BOOST_CHECK( vs->get_element().sorry_flag == false );
+    BOOST_CHECK( vs->get_element().qos_upstream == elem3.qos_upstream );
+    BOOST_CHECK( vs->get_element().qos_downstream == elem3.qos_downstream );
+
+
+    // unit_test[43]  IPv6アドレスでVS変更(TCP endpoint不一致による失敗ケース)
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------43" );
+    l7vs::virtualservice_element    elem4;
+    elem4.udpmode                    = false;
+    elem4.tcp_accept_endpoint        = 
+            tcp_ep_type( boost::asio::ip::address::from_string( "1234:5678:90AB:CDEF:0000:0000:FEDC:BA00" ), (60000) );
+    elem4.udp_recv_endpoint            = 
+            udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem4.realserver_vector.clear();
+    elem4.protocol_module_name        = "PMtest1";
+    elem4.schedule_module_name        = "SMtest1";
+    elem4.protocol_args.clear();
+    elem4.sorry_maxconnection        = 3333LL;
+    elem4.sorry_endpoint            = tcp_ep_type();
+    elem4.sorry_flag                = true;
+    elem4.qos_upstream                = 65535ULL;
+    elem4.qos_downstream            = 32767ULL;
+
+    vs_err.setter(false,"");
+    vs->edit_virtualservice( elem4, vs_err );
+    BOOST_CHECK( vs_err == true );
+    BOOST_CHECK( vs->get_element().sorry_maxconnection == 0LL );
+    BOOST_MESSAGE( vs->get_element().sorry_maxconnection );
+    BOOST_CHECK( vs->get_element().sorry_endpoint == tcp_ep_type() );
+    BOOST_MESSAGE( vs->get_element().sorry_endpoint );
+    BOOST_CHECK( vs->get_element().sorry_flag == false );
+    BOOST_MESSAGE( vs->get_element().sorry_flag );
+    BOOST_MESSAGE( vs->get_element().qos_upstream );
+    BOOST_CHECK( vs->get_element().qos_upstream == elem3.qos_upstream );
+    BOOST_MESSAGE( vs->get_element().qos_downstream );
+    BOOST_CHECK( vs->get_element().qos_downstream == elem3.qos_downstream );
+
+    // unit_test[44]  IPv6アドレスでRS追加
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------44" );
+    //RSパラメータ設定
+    l7vs::virtualservice_element    elem_add_rs1;
+    elem_add_rs1.udpmode                    = false;
+    elem_add_rs1.tcp_accept_endpoint        = 
+            tcp_ep_type( boost::asio::ip::address_v6::loopback(), (50000) );
+    elem_add_rs1.udp_recv_endpoint            = 
+            udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem_add_rs1.realserver_vector.clear();
+    elem_add_rs1.protocol_module_name        = "PMtest1";
+    elem_add_rs1.schedule_module_name        = "SMtest1";
+    elem_add_rs1.protocol_args.clear();
+    elem_add_rs1.sorry_maxconnection        = 1234LL;
+    elem_add_rs1.sorry_endpoint                = tcp_ep_type();
+    elem_add_rs1.sorry_flag                    = false;
+    elem_add_rs1.qos_upstream                = 65535ULL;
+    elem_add_rs1.qos_downstream                = 32767ULL;
+    for( size_t i = 0; i < 10; ++i ){
+        l7vs::realserver_element    rs_elem;
+        rs_elem.tcp_endpoint = 
+            tcp_ep_type( boost::asio::ip::address::from_string( "1234:5678::0000:0000:90AB:CDEF" ), (i+8080) );
+        elem_add_rs1.realserver_vector.push_back( rs_elem );
+        rs_elem.weight    = i+1;
+    }
+    vs_err.setter(false,"");
+    vs->add_realserver( elem_add_rs1, vs_err );
+    BOOST_CHECK( vs_err == false );
+
+    // unit_test[45]  IPv6アドレスでRS追加(既に追加されているendpointを追加しようとして失敗ケース)
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------45" );
+    //RSパラメータ設定
+    l7vs::virtualservice_element    elem_add_rs2;
+    {
+        elem_add_rs2.udpmode                    = false;
+        elem_add_rs2.tcp_accept_endpoint        = 
+            tcp_ep_type( boost::asio::ip::address_v6::loopback(), (50000) );
+        elem_add_rs2.udp_recv_endpoint            = 
+                udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+        elem_add_rs2.realserver_vector.clear();
+        elem_add_rs2.protocol_module_name        = "PMtest1";
+        l7vs::realserver_element    rs_elem;
+        rs_elem.tcp_endpoint = 
+                tcp_ep_type( boost::asio::ip::address::from_string( "1234:5678::0000:0000:90AB:CDEF" ), (8080) );
+        rs_elem.weight    = 10;
+        elem_add_rs2.realserver_vector.push_back( rs_elem );
+    }
+
+    vs_err.setter(false,"");
+    vs->add_realserver( elem_add_rs2, vs_err );
+    BOOST_CHECK( vs_err == true );
+
+    // unit_test[46]  IPv6アドレスでRS追加(VSが不一致で失敗ケース)
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------46" );
+    l7vs::virtualservice_element    elem_add_rs3;
+    {
+        elem_add_rs3.udpmode                    = false;
+        elem_add_rs3.tcp_accept_endpoint        = 
+                tcp_ep_type( boost::asio::ip::address::from_string( "1234:5678:90AB:CDEF:0000:0000:FEDC:0009" ), (60000) );
+        elem_add_rs3.udp_recv_endpoint            = 
+                udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+        elem_add_rs3.realserver_vector.clear();
+        elem_add_rs3.protocol_module_name        = "PMtest1";
+        l7vs::realserver_element    rs_elem;
+        rs_elem.tcp_endpoint = 
+                tcp_ep_type( boost::asio::ip::address::from_string( "1234:5678::0000:0000:90AB:CDEF" ), (6006) );
+        rs_elem.weight    = 10;
+        elem_add_rs3.realserver_vector.push_back( rs_elem );
+    }
+
+    vs_err.setter(false,"");
+    vs->add_realserver( elem_add_rs2, vs_err );
+    BOOST_CHECK( vs_err == true );
+
+    // unit_test[47]  IPv6アドレスでRS編集
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------47" );
+    l7vs::virtualservice_element    elem_edit_rs1;
+    {
+        elem_edit_rs1.udpmode                    = false;
+        elem_edit_rs1.tcp_accept_endpoint        = 
+            tcp_ep_type( boost::asio::ip::address_v6::loopback(), (50000) );
+        elem_edit_rs1.udp_recv_endpoint            = 
+                udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+        elem_edit_rs1.realserver_vector.clear();
+        elem_edit_rs1.protocol_module_name        = "PMtest1";
+        l7vs::realserver_element    rs_elem;
+        rs_elem.tcp_endpoint = 
+                tcp_ep_type( boost::asio::ip::address::from_string( "1234:5678::0000:0000:90AB:CDEF" ), (8080) );
+        rs_elem.weight    = 10;
+        elem_edit_rs1.realserver_vector.push_back( rs_elem );
+    }
+
+    vs_err.setter(false,"");
+    vs->edit_realserver( elem_edit_rs1, vs_err );
+    BOOST_CHECK( vs_err == false );
+    BOOST_CHECK( vs->get_rs_list().begin()->weight == 10 );
+
+    // unit_test[48]  IPv6アドレスでRS編集(リストに一致するRSが存在しないので失敗する)
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------48" );
+    l7vs::virtualservice_element    elem_edit_rs2;
+    {
+        elem_edit_rs2.udpmode                    = false;
+        elem_edit_rs2.tcp_accept_endpoint        = 
+            tcp_ep_type( boost::asio::ip::address_v6::loopback(), (50000) );
+        elem_edit_rs2.udp_recv_endpoint            = 
+                udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+        elem_edit_rs2.realserver_vector.clear();
+        elem_edit_rs2.protocol_module_name        = "PMtest1";
+        l7vs::realserver_element    rs_elem;
+        rs_elem.tcp_endpoint = 
+                tcp_ep_type( boost::asio::ip::address::from_string( "1234:5678::0000:0000:90AB:3891" ), (8080) );
+        rs_elem.weight    = 10;
+        elem_edit_rs2.realserver_vector.push_back( rs_elem );
+    }
+    vs_err.setter(false,"");
+    vs->edit_realserver( elem_edit_rs2, vs_err );
+    BOOST_CHECK( vs_err == true );
+
+    // unit_test[49]  IPv6アドレスでRS編集(VSが不一致で失敗する)
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------49" );
+    l7vs::virtualservice_element    elem_edit_rs3;
+    {
+        elem_edit_rs3.udpmode                    = false;
+        elem_edit_rs3.tcp_accept_endpoint        = 
+                tcp_ep_type( boost::asio::ip::address::from_string( "1234:5678:90AB:CDEF:0000:0000:FEDC:0009" ), (60000) );
+        elem_edit_rs3.udp_recv_endpoint            = 
+                udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+        elem_edit_rs3.realserver_vector.clear();
+        elem_edit_rs3.protocol_module_name        = "PMtest1";
+        l7vs::realserver_element    rs_elem;
+        rs_elem.tcp_endpoint = 
+                tcp_ep_type( boost::asio::ip::address::from_string( "1234:5678::0000:0000:90AB:CDEF" ), (8080) );
+        rs_elem.weight    = 10;
+        elem_edit_rs3.realserver_vector.push_back( rs_elem );
+    }
+
+    vs_err.setter(false,"");
+    vs->edit_realserver( elem_edit_rs3, vs_err );
+    BOOST_CHECK( vs_err == true );
+
+    // unit_test[50]  IPv6アドレスでRS削除(VSが一致しないので失敗する)
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------50" );
+    l7vs::virtualservice_element    elem_del_rs1;
+    {
+        elem_del_rs1.udpmode                    = false;
+        elem_del_rs1.tcp_accept_endpoint        = 
+                tcp_ep_type( boost::asio::ip::address::from_string( "1234:5678:90AB:CDEF:0000:0000:FEDC:0009" ), (60000) );
+        elem_del_rs1.udp_recv_endpoint            = 
+                udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+        elem_del_rs1.realserver_vector.clear();
+        elem_del_rs1.protocol_module_name        = "PMtest1";
+        l7vs::realserver_element    rs_elem;
+        rs_elem.tcp_endpoint = 
+                tcp_ep_type( boost::asio::ip::address::from_string( "1234:5678::0000:0000:90AB:CDEF" ), (8080) );
+        rs_elem.weight    = 10;
+        elem_del_rs1.realserver_vector.push_back( rs_elem );
+    }
+    vs_err.setter(false,"");
+    vs->del_realserver( elem_del_rs1, vs_err );
+    BOOST_CHECK( vs_err == true );
+
+    // unit_test[51]  IPv6アドレスでRS削除(リストに一致するRSが存在しないので失敗する)
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------51" );
+    l7vs::virtualservice_element    elem_del_rs2;
+    {
+        elem_del_rs2.udpmode                    = false;
+        elem_del_rs2.tcp_accept_endpoint        = 
+            tcp_ep_type( boost::asio::ip::address_v6::loopback(), (50000) );
+        elem_del_rs2.udp_recv_endpoint            = 
+                udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+        elem_del_rs2.realserver_vector.clear();
+        elem_del_rs2.protocol_module_name        = "PMtest1";
+        l7vs::realserver_element    rs_elem;
+        rs_elem.tcp_endpoint = 
+                tcp_ep_type( boost::asio::ip::address::from_string( "1234:5678::0000:0000:1111:CDEF" ), (8080) );
+        rs_elem.weight    = 10;
+        elem_del_rs2.realserver_vector.push_back( rs_elem );
+    }
+
+    vs_err.setter(false,"");
+    vs->del_realserver( elem_del_rs2, vs_err );
+    BOOST_CHECK( vs_err == true );
+
+    // unit_test[52]  IPv6アドレスでRS削除
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------52" );
+    l7vs::virtualservice_element    elem_del_rs3;
+    {
+        elem_del_rs3.udpmode                    = false;
+        elem_del_rs3.tcp_accept_endpoint        = 
+            tcp_ep_type( boost::asio::ip::address_v6::loopback(), (50000) );
+        elem_del_rs3.udp_recv_endpoint            = 
+                udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+        elem_del_rs3.realserver_vector.clear();
+        elem_del_rs3.protocol_module_name        = "PMtest1";
+        l7vs::realserver_element    rs_elem;
+        rs_elem.tcp_endpoint = 
+                tcp_ep_type( boost::asio::ip::address::from_string( "1234:5678::0000:0000:90AB:CDEF" ), (8080) );
+        rs_elem.weight    = 10;
+        elem_del_rs3.realserver_vector.push_back( rs_elem );
+    }
+
+    vs_err.setter(false,"");
+    vs->del_realserver( elem_del_rs3, vs_err );
+    BOOST_CHECK( vs_err == false );
+    BOOST_CHECK( vs->get_rs_list().size() == 9 );
+
+    //テストが終わったらStubのレプリケーションエリアを削除
+    debugg_flug_struct::getInstance().create_rep_area();
+
+    vs_err.setter(false,"");
+    vs->finalize( vs_err );
+    delete vs;
+}
+
+//実際にAcceptさせるテスト
+void    virtualservice_tcp_test5(){
+    // unit_test[53]  ClientからConnectさせてAcceptすることを確認する
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------53" );
+    debugg_flug_struct::getInstance().param_exist_flag() = false;
+    debugg_flug_struct::getInstance().pmcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().smcontrol_err_flag()    = false;
+
+    l7vs::error_code            vs_err;
+    boost::system::error_code    test_err;
+
+    std::stringstream    tmp_tcp_ep;
+    std::stringstream    tmp_udp_ep;
+    std::stringstream    tmp_sorry_ep;
+
+    l7vs::l7vsd                    vsd;
+    boost::asio::io_service        dispatcher;
+    l7vs::replication            rep;
+    l7vs::virtualservice_element    elem1;
+
+    //set element value
+    elem1.udpmode                    = false;
+    elem1.tcp_accept_endpoint        = 
+            tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem1.udp_recv_endpoint            = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem1.realserver_vector.clear();
+    elem1.protocol_module_name        = "PMtest1";
+    elem1.schedule_module_name        = "SMtest1";
+    elem1.protocol_args.clear();
+    elem1.sorry_maxconnection        = 1234LL;
+    elem1.sorry_endpoint            = 
+            tcp_ep_type( boost::asio::ip::address::from_string( "AFAF:0E08::8FDE" ), (8080) );
+    elem1.sorry_flag                = false;
+    elem1.qos_upstream                = 65535ULL;
+    elem1.qos_downstream            = 32767ULL;
+    elem1.ssl_file_name            = "";
+
+    //vs作成
+    l7vs::vs_tcp*    vs = new l7vs::vs_tcp( vsd, rep, elem1 );
+
+    vs_err.setter(false,"");
+    vs->initialize( vs_err );
+
+    boost::thread    vs_main( &l7vs::vs_tcp::run, vs );
+    usleep( 2000000 );
+    boost::thread    cl_thread( &client );
+
+    //2秒待ってsessionプールのサイズをチェック
+    usleep( 2000000 );
+    BOOST_CHECK( vs->get_pool_sessions().size() == l7vs::virtualservice_base::SESSION_POOL_NUM_DEFAULT-2 );
+
+    debugg_flug_struct::getInstance().stub_loglevel() = l7vs::LOG_LV_DEBUG;
+    //1秒待ってmainをSTOP
+    usleep( 1000000 );
+    vs->stop();
+std::cout << "!" << std::endl;
+
+    usleep( 1000 );
+    cl_thread.join();
+    vs_main.join();
+std::cout << "!" << std::endl;
+
+    vs_err.setter(false,"");
+   // vs->finalize( vs_err );
+std::cout << "!" << std::endl;
+    delete vs;
+}
+
+//test case6  set_socket_option test
+void    virtualservice_tcp_set_socket_option(){
+    counter = 1;
+
+    debugg_flug_struct::getInstance().pmcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().smcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().param_exist_flag() = false;
+
+    l7vs::l7vsd                    vsd;
+    boost::asio::io_service        dispatcher;
+    l7vs::replication            rep;
+    l7vs::virtualservice_element    element;
+    //set element value
+    element.udpmode                    = false;
+    element.tcp_accept_endpoint        = tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    element.udp_recv_endpoint        = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    element.realserver_vector.clear();
+    element.protocol_module_name    = "PMtest1";
+    element.schedule_module_name    = "SMtest1";
+    element.protocol_args.clear();
+    element.protocol_args.push_back( "testarg" );
+    element.protocol_args.push_back( "testarg2" );
+    element.sorry_maxconnection        = 1234LL;
+    element.sorry_endpoint            = tcp_ep_type( boost::asio::ip::address::from_string( "10.144.169.87" ), (8080) );
+    element.sorry_flag                = false;
+    element.qos_upstream            = 65535ULL;
+    element.qos_downstream            = 32767ULL;
+    
+//    std::cout << counter++ << std::endl;
+    l7vs::vs_tcp*    vs = new l7vs::vs_tcp( vsd, rep, element );
+
+    BOOST_CHECK_EQUAL( &vsd, &(vs->get_vsd()) );
+    BOOST_CHECK_EQUAL( &rep, &(vs->get_rep()) );
+    BOOST_CHECK( element == vs->get_element() );
+    
+    
+    std::cout << "parse_socket_option normal case 01 (all socket option off)" << std::endl;
+    // parse_socket_option normal case 01 (all socket option off)
+    {
+
+        vs->get_element().socket_option_tcp_defer_accept   = 0;
+        vs->get_element().socket_option_tcp_nodelay        = 0;
+        vs->get_element().socket_option_tcp_cork           = 0;
+        vs->get_element().socket_option_tcp_quickack       = 0;
+
+        vs->set_socket_option();
+
+
+        //! TCP_DEFER_ACCEPT option
+        // unit_test[56] parse_socket_option normal case 01 (set option TCP_DEFER_ACCEPT) check
+        BOOST_CHECK_EQUAL( vs->get_defer_accept_opt(), false );
+        //! TCP_DEFER_ACCEPT option value
+        // unit_test[57] parse_socket_option normal case 01 (set option TCP_DEFER_ACCEPT value) check
+        BOOST_CHECK_EQUAL( vs->get_defer_accept_val(), 0 );
+        //! TCP_NODELAY   (false:not set,true:set option)
+        // unit_test[58] parse_socket_option normal case 01 (set option TCP_NODELAY) check
+        BOOST_CHECK_EQUAL( vs->get_set_sock_opt().nodelay_opt, false );
+        //! TCP_NODELAY option value  (false:off,true:on)
+        // unit_test[59] parse_socket_option normal case 01 (set option TCP_NODELAY value) check
+        BOOST_CHECK_EQUAL( vs->get_set_sock_opt().nodelay_val, false );
+        //! TCP_CORK      (false:not set,true:set option)
+        // unit_test[60] parse_socket_option normal case 01 (set option TCP_CORK) check
+        BOOST_CHECK_EQUAL( vs->get_set_sock_opt().cork_opt, false );
+        //! TCP_CORK option value     (false:off,true:on)
+        // unit_test[61] parse_socket_option normal case 01 (set option TCP_CORK value) check
+        BOOST_CHECK_EQUAL( vs->get_set_sock_opt().cork_val, false );
+        //! TCP_QUICKACK  (false:not set,true:set option)
+        // unit_test[62] parse_socket_option normal case 01 (set option TCP_QUICKACK) check
+        BOOST_CHECK_EQUAL( vs->get_set_sock_opt().quickack_opt, false );
+        //! TCP_QUICKACK option value (false:off,true:on)
+        // unit_test[63] parse_socket_option normal case 01 (set option TCP_QUICKACK value) check
+        BOOST_CHECK_EQUAL( vs->get_set_sock_opt().quickack_val, false );
+
+    }
+
+    std::cout << "parse_socket_option normal case 02 (all socket option on)" << std::endl;
+    // parse_socket_option normal case 02 (all socket option on)
+    {
+
+        vs->get_element().socket_option_tcp_defer_accept   = 1;
+        vs->get_element().socket_option_tcp_nodelay        = 1;
+        vs->get_element().socket_option_tcp_cork           = 1;
+        vs->get_element().socket_option_tcp_quickack       = 1;
+
+        vs->set_socket_option();
+
+
+        //! TCP_DEFER_ACCEPT option
+        // unit_test[64] parse_socket_option normal case 01 (set option TCP_DEFER_ACCEPT) check
+        BOOST_CHECK_EQUAL( vs->get_defer_accept_opt(), true );
+        //! TCP_DEFER_ACCEPT option value
+        // unit_test[65] parse_socket_option normal case 01 (set option TCP_DEFER_ACCEPT value) check
+        BOOST_CHECK_EQUAL( vs->get_defer_accept_val(), 1 );
+        //! TCP_NODELAY   (false:not set,true:set option)
+        // unit_test[66] parse_socket_option normal case 01 (set option TCP_NODELAY) check
+        BOOST_CHECK_EQUAL( vs->get_set_sock_opt().nodelay_opt, true );
+        //! TCP_NODELAY option value  (false:off,true:on)
+        // unit_test[67] parse_socket_option normal case 01 (set option TCP_NODELAY value) check
+        BOOST_CHECK_EQUAL( vs->get_set_sock_opt().nodelay_val, true );
+        //! TCP_CORK      (false:not set,true:set option)
+        // unit_test[68] parse_socket_option normal case 01 (set option TCP_CORK) check
+        BOOST_CHECK_EQUAL( vs->get_set_sock_opt().cork_opt, true );
+        //! TCP_CORK option value     (false:off,true:on)
+        // unit_test[69] parse_socket_option normal case 01 (set option TCP_CORK value) check
+        BOOST_CHECK_EQUAL( vs->get_set_sock_opt().cork_val, true );
+        //! TCP_QUICKACK  (false:not set,true:set option)
+        // unit_test[70] parse_socket_option normal case 01 (set option TCP_QUICKACK) check
+        BOOST_CHECK_EQUAL( vs->get_set_sock_opt().quickack_opt, true );
+        //! TCP_QUICKACK option value (false:off,true:on)
+        // unit_test[71] parse_socket_option normal case 01 (set option TCP_QUICKACK value) check
+        BOOST_CHECK_EQUAL( vs->get_set_sock_opt().quickack_val, true );
+
+    }
+
+
+    std::cout << "parse_socket_option normal case 03 (all socket option on)" << std::endl;
+    // parse_socket_option normal case 03 (all socket option on)
+    {
+
+        element.socket_option_tcp_defer_accept   = 1;
+        element.socket_option_tcp_nodelay        = 1;
+        element.socket_option_tcp_cork           = 1;
+        element.socket_option_tcp_quickack       = 2;
+
+        vs->set_socket_option();
+
+
+        //! TCP_DEFER_ACCEPT option
+        // unit_test[72] parse_socket_option normal case 01 (set option TCP_DEFER_ACCEPT) check
+        BOOST_CHECK_EQUAL( vs->get_defer_accept_opt(), true );
+        //! TCP_DEFER_ACCEPT option value
+        // unit_test[73] parse_socket_option normal case 01 (set option TCP_DEFER_ACCEPT value) check
+        BOOST_CHECK_EQUAL( vs->get_defer_accept_val(), 1 );
+        //! TCP_NODELAY   (false:not set,true:set option)
+        // unit_test[74] parse_socket_option normal case 01 (set option TCP_NODELAY) check
+        BOOST_CHECK_EQUAL( vs->get_set_sock_opt().nodelay_opt, true );
+        //! TCP_NODELAY option value  (false:off,true:on)
+        // unit_test[75] parse_socket_option normal case 01 (set option TCP_NODELAY value) check
+        BOOST_CHECK_EQUAL( vs->get_set_sock_opt().nodelay_val, true );
+        //! TCP_CORK      (false:not set,true:set option)
+        // unit_test[76] parse_socket_option normal case 01 (set option TCP_CORK) check
+        BOOST_CHECK_EQUAL( vs->get_set_sock_opt().cork_opt, true );
+        //! TCP_CORK option value     (false:off,true:on)
+        // unit_test[77] parse_socket_option normal case 01 (set option TCP_CORK value) check
+        BOOST_CHECK_EQUAL( vs->get_set_sock_opt().cork_val, true );
+        //! TCP_QUICKACK  (false:not set,true:set option)
+        // unit_test[78] parse_socket_option normal case 01 (set option TCP_QUICKACK) check
+        BOOST_CHECK_EQUAL( vs->get_set_sock_opt().quickack_opt, true );
+        //! TCP_QUICKACK option value (false:off,true:on)
+        // unit_test[79] parse_socket_option normal case 01 (set option TCP_QUICKACK value) check
+        BOOST_CHECK_EQUAL( vs->get_set_sock_opt().quickack_val, true );
+
+    }
+
+
+    BOOST_MESSAGE( "-------9" );
+    delete vs;
+
+    
+}
+
+
+// get_ssl_password test
+void    virtualservice_tcp_get_ssl_password(){
+    counter = 1;
+
+    debugg_flug_struct::getInstance().pmcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().smcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().param_exist_flag() = false;
+
+    l7vs::l7vsd                    vsd;
+    boost::asio::io_service        dispatcher;
+    l7vs::replication              rep;
+    l7vs::virtualservice_element   element;
+    //set element value
+    element.udpmode                = false;
+    element.tcp_accept_endpoint    = tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    element.udp_recv_endpoint      = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    element.realserver_vector.clear();
+    element.protocol_module_name   = "PMtest1";
+    element.schedule_module_name   = "SMtest1";
+    element.protocol_args.clear();
+    element.protocol_args.push_back( "testarg" );
+    element.protocol_args.push_back( "testarg2" );
+    element.sorry_maxconnection    = 1234LL;
+    element.sorry_endpoint         = tcp_ep_type( boost::asio::ip::address::from_string( "10.144.169.87" ), (8080) );
+    element.sorry_flag             = false;
+    element.qos_upstream           = 65535ULL;
+    element.qos_downstream         = 32767ULL;
+
+//    std::cout << counter++ << std::endl;
+    l7vs::vs_tcp*    vs = new l7vs::vs_tcp( vsd, rep, element );
+
+    BOOST_CHECK_EQUAL( &vsd, &(vs->get_vsd()) );
+    BOOST_CHECK_EQUAL( &rep, &(vs->get_rep()) );
+    BOOST_CHECK( element == vs->get_element() );
+
+    std::cout << "get_ssl_password normal case 01" << std::endl;
+    // get_ssl_password normal case 01
+    {
+        std::string       ssl_passwd           = "ssl_test";
+        std::string       ssl_passwd_dir       = "./sslfiles/";
+        std::string       ssl_passwd_file      = "ssl_password_file1";
+        std::string       ssl_passwd_full_path = ssl_passwd_dir + ssl_passwd_file;
+
+        std::ofstream     ofs( ssl_passwd_full_path.c_str() );
+        ofs << ssl_passwd << "\n";
+        ofs.close();
+
+        vs->set_private_key_passwd_dir( ssl_passwd_dir );
+        vs->set_private_key_passwd_file( ssl_passwd_file );
+
+        std::string return_ssl_password = vs->get_ssl_password();
+
+        //! TCP_DEFER_ACCEPT option
+        // unit_test[80] ssl password check
+        BOOST_CHECK_EQUAL( return_ssl_password, ssl_passwd );
+
+        unlink( ssl_passwd_full_path.c_str() );
+
+    }
+
+    std::cout << "get_ssl_password error case 01 dir empty" << std::endl;
+    // get_ssl_password normal error case 01 dir empty
+    {
+        std::string       ssl_passwd           = "";
+        std::string       ssl_passwd_dir       = "";
+        std::string       ssl_passwd_file      = "ssl_password_file1";
+
+        vs->set_private_key_passwd_dir( ssl_passwd_dir );
+        vs->set_private_key_passwd_file( ssl_passwd_file );
+
+        std::string return_ssl_password = vs->get_ssl_password();
+
+        //! TCP_DEFER_ACCEPT option
+        // unit_test[81] ssl password check
+        BOOST_CHECK_EQUAL( return_ssl_password, ssl_passwd );
+
+    }
+
+    std::cout <<"get_ssl_password error case 02 password size over"<<std::endl;
+    // get_ssl_password normal error case 02 password size over
+    {
+        std::string       ssl_passwd           = "";
+        ssl_passwd += "1234567890";
+        ssl_passwd += "1234567890";
+        ssl_passwd += "1234567890";
+        ssl_passwd += "1234567890";
+        ssl_passwd += "1234567890";
+        ssl_passwd += "1234567890";
+        ssl_passwd += "1234567890";
+        ssl_passwd += "1234567890";
+        ssl_passwd += "1234567890";
+        ssl_passwd += "1234567890";
+        ssl_passwd += "1234567890";
+        ssl_passwd += "1234567890";
+        ssl_passwd += "1234567890";
+        ssl_passwd += "1234567890";
+        ssl_passwd += "1234567890";
+        ssl_passwd += "1234567890";
+        ssl_passwd += "1234567890";
+        ssl_passwd += "1234567890";
+        ssl_passwd += "1234567890";
+        ssl_passwd += "1234567890";
+        ssl_passwd += "1234567890";
+        ssl_passwd += "1234567890";
+        ssl_passwd += "1234567890";
+        ssl_passwd += "1234567890";
+        ssl_passwd += "1234567890";
+        ssl_passwd += "1234567890";
+
+        std::string       ssl_passwd_dir       = "./sslfiles/";
+        std::string       ssl_passwd_file      = "ssl_password_file1";
+
+        std::string       ssl_passwd_full_path = ssl_passwd_dir + ssl_passwd_file;
+        std::ofstream     ofs( ssl_passwd_full_path.c_str() );
+        ofs << ssl_passwd << "\n";
+        ofs.close();
+
+        vs->set_private_key_passwd_dir( ssl_passwd_dir );
+        vs->set_private_key_passwd_file( ssl_passwd_file );
+
+        std::string return_ssl_password = vs->get_ssl_password();
+
+        //! TCP_DEFER_ACCEPT option
+        // unit_test[82] ssl password check
+        BOOST_CHECK_EQUAL( return_ssl_password, "" );
+
+    }
+
+    std::cout << "get_ssl_password error case 03 file empty" << std::endl;
+    // get_ssl_password normal error case 03 file empty
+    {
+        std::string       ssl_passwd           = "";
+        std::string       ssl_passwd_dir       = "./sslfiles/";
+        std::string       ssl_passwd_file      = "ssl_password_file1";
+        std::string       ssl_passwd_full_path = ssl_passwd_dir + ssl_passwd_file;
+
+        std::ofstream     ofs( ssl_passwd_full_path.c_str() );
+        ofs.close();
+
+        vs->set_private_key_passwd_dir( ssl_passwd_dir );
+        vs->set_private_key_passwd_file( ssl_passwd_file );
+
+        std::string return_ssl_password = vs->get_ssl_password();
+
+        //! TCP_DEFER_ACCEPT option
+        // unit_test[83] ssl password check
+        BOOST_CHECK_EQUAL( return_ssl_password, ssl_passwd );
+
+        unlink( ssl_passwd_full_path.c_str() );
+
+
+    }
+
+
+    BOOST_MESSAGE( "-------??" );
+    delete vs;
+
+}
+
+// conv_verify_option test
+void    virtualservice_tcp_conv_verify_option(){
+    counter = 1;
+
+    debugg_flug_struct::getInstance().pmcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().smcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().param_exist_flag() = false;
+
+    l7vs::l7vsd                    vsd;
+    boost::asio::io_service        dispatcher;
+    l7vs::replication            rep;
+    l7vs::virtualservice_element    element;
+    //set element value
+    element.udpmode                    = false;
+    element.tcp_accept_endpoint        = tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    element.udp_recv_endpoint        = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    element.realserver_vector.clear();
+    element.protocol_module_name    = "PMtest1";
+    element.schedule_module_name    = "SMtest1";
+    element.protocol_args.clear();
+    element.protocol_args.push_back( "testarg" );
+    element.protocol_args.push_back( "testarg2" );
+    element.sorry_maxconnection        = 1234LL;
+    element.sorry_endpoint            = tcp_ep_type( boost::asio::ip::address::from_string( "10.144.169.87" ), (8080) );
+    element.sorry_flag                = false;
+    element.qos_upstream            = 65535ULL;
+    element.qos_downstream            = 32767ULL;
+
+//    std::cout << counter++ << std::endl;
+    l7vs::vs_tcp*    vs = new l7vs::vs_tcp( vsd, rep, element );
+
+    BOOST_CHECK_EQUAL( &vsd, &(vs->get_vsd()) );
+    BOOST_CHECK_EQUAL( &rep, &(vs->get_rep()) );
+    BOOST_CHECK( element == vs->get_element() );
+
+    std::cout << "conv_verify_option SSL_VERIFY_NONE case" << std::endl;
+    // conv_verify_option SSL_VERIFY_NONE case
+    {
+        std::string input_verify_option = "SSL_VERIFY_NONE";
+    
+        int return_verify_option = vs->conv_verify_option(input_verify_option);
+    
+        //! SSL_VERIFY_NONE option
+        // unit_test[84] verify_option check
+        BOOST_CHECK_EQUAL( return_verify_option, SSL_VERIFY_NONE );
+    
+    }
+
+    std::cout << "conv_verify_option SSL_VERIFY_PEER case" << std::endl;
+    // conv_verify_option SSL_VERIFY_PEER case
+    {
+        std::string input_verify_option = "SSL_VERIFY_PEER";
+    
+        int return_verify_option = vs->conv_verify_option(input_verify_option);
+    
+        //! SSL_VERIFY_PEER option
+        // unit_test[85] verify_option check
+        BOOST_CHECK_EQUAL( return_verify_option, SSL_VERIFY_PEER );
+    
+    }
+
+    std::cout << "conv_verify_option SSL_VERIFY_FAIL_IF_NO_PEER_CERT case" << std::endl;
+    // conv_verify_option SSL_VERIFY_FAIL_IF_NO_PEER_CERT case
+    {
+        std::string input_verify_option = "SSL_VERIFY_FAIL_IF_NO_PEER_CERT";
+    
+        int return_verify_option = vs->conv_verify_option(input_verify_option);
+    
+        //! SSL_VERIFY_FAIL_IF_NO_PEER_CERT option
+        // unit_test[86] verify_option check
+        BOOST_CHECK_EQUAL( return_verify_option, SSL_VERIFY_FAIL_IF_NO_PEER_CERT );
+    
+    }
+
+    std::cout << "conv_verify_option SSL_VERIFY_CLIENT_ONCE case" << std::endl;
+    // conv_verify_option SSL_VERIFY_CLIENT_ONCE case
+    {
+        std::string input_verify_option = "SSL_VERIFY_CLIENT_ONCE";
+    
+        int return_verify_option = vs->conv_verify_option(input_verify_option);
+    
+        //! SSL_VERIFY_CLIENT_ONCE option
+        // unit_test[87] verify_option check
+        BOOST_CHECK_EQUAL( return_verify_option, SSL_VERIFY_CLIENT_ONCE );
+    
+    }
+
+
+    std::cout << "conv_verify_option error case" << std::endl;
+    // conv_verify_option error case
+    {
+        std::string input_verify_option = "error";
+    
+        int return_verify_option = vs->conv_verify_option(input_verify_option);
+    
+        //! error option
+        // unit_test[88] verify_option error check
+        BOOST_CHECK_EQUAL( return_verify_option, -1 );
+    
+    }
+
+    BOOST_MESSAGE( "-------??" );
+    delete vs;
+
+}
+
+
+// conv_ssl_option test
+void    virtualservice_tcp_conv_ssl_option(){
+    counter = 1;
+
+    debugg_flug_struct::getInstance().pmcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().smcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().param_exist_flag() = false;
+
+    l7vs::l7vsd                    vsd;
+    boost::asio::io_service        dispatcher;
+    l7vs::replication            rep;
+    l7vs::virtualservice_element    element;
+    //set element value
+    element.udpmode                    = false;
+    element.tcp_accept_endpoint        = tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    element.udp_recv_endpoint        = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    element.realserver_vector.clear();
+    element.protocol_module_name    = "PMtest1";
+    element.schedule_module_name    = "SMtest1";
+    element.protocol_args.clear();
+    element.protocol_args.push_back( "testarg" );
+    element.protocol_args.push_back( "testarg2" );
+    element.sorry_maxconnection        = 1234LL;
+    element.sorry_endpoint            = tcp_ep_type( boost::asio::ip::address::from_string( "10.144.169.87" ), (8080) );
+    element.sorry_flag                = false;
+    element.qos_upstream            = 65535ULL;
+    element.qos_downstream            = 32767ULL;
+
+//    std::cout << counter++ << std::endl;
+    l7vs::vs_tcp*    vs = new l7vs::vs_tcp( vsd, rep, element );
+
+    BOOST_CHECK_EQUAL( &vsd, &(vs->get_vsd()) );
+    BOOST_CHECK_EQUAL( &rep, &(vs->get_rep()) );
+    BOOST_CHECK( element == vs->get_element() );
+
+    std::cout << "conv_ssl_option SSL_OP_MICROSOFT_SESS_ID_BUG case" << std::endl;
+    // conv_ssl_option SSL_OP_MICROSOFT_SESS_ID_BUG case
+    {
+        std::string input_ssl_option = "SSL_OP_MICROSOFT_SESS_ID_BUG";
+    
+        long int return_ssl_option = vs->conv_ssl_option(input_ssl_option);
+    
+        //! SSL_OP_MICROSOFT_SESS_ID_BUG option
+        // unit_test[89] conv_ssl_option check
+        BOOST_CHECK_EQUAL( return_ssl_option, SSL_OP_MICROSOFT_SESS_ID_BUG );
+    
+    }
+
+    std::cout << "conv_ssl_option SSL_OP_NETSCAPE_CHALLENGE_BUG case" << std::endl;
+    // conv_ssl_option SSL_OP_NETSCAPE_CHALLENGE_BUG case
+    {
+        std::string input_ssl_option = "SSL_OP_NETSCAPE_CHALLENGE_BUG";
+    
+        long int return_ssl_option = vs->conv_ssl_option(input_ssl_option);
+    
+        //! SSL_OP_NETSCAPE_CHALLENGE_BUG option
+        // unit_test[90] conv_ssl_option check
+        BOOST_CHECK_EQUAL( return_ssl_option, SSL_OP_NETSCAPE_CHALLENGE_BUG );
+    
+    }
+
+    std::cout << "conv_ssl_option SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG case" << std::endl;
+    // conv_ssl_option SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG case
+    {
+        std::string input_ssl_option = "SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG";
+    
+        long int return_ssl_option = vs->conv_ssl_option(input_ssl_option);
+    
+        //! SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG option
+        // unit_test[91] conv_ssl_option check
+        BOOST_CHECK_EQUAL( return_ssl_option, SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG );
+    
+    }
+
+    std::cout << "conv_ssl_option SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG case" << std::endl;
+    // conv_ssl_option SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG case
+    {
+        std::string input_ssl_option = "SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG";
+    
+        long int return_ssl_option = vs->conv_ssl_option(input_ssl_option);
+    
+        //! SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG option
+        // unit_test[92] conv_ssl_option check
+        BOOST_CHECK_EQUAL( return_ssl_option, SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG );
+    
+    }
+
+    std::cout << "conv_ssl_option SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER case" << std::endl;
+    // conv_ssl_option SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER case
+    {
+        std::string input_ssl_option = "SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER";
+    
+        long int return_ssl_option = vs->conv_ssl_option(input_ssl_option);
+    
+        //! SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER option
+        // unit_test[93] conv_ssl_option check
+        BOOST_CHECK_EQUAL( return_ssl_option, SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER );
+    
+    }
+
+    std::cout << "conv_ssl_option SSL_OP_MSIE_SSLV2_RSA_PADDING case" << std::endl;
+    // conv_ssl_option SSL_OP_MSIE_SSLV2_RSA_PADDING case
+    {
+        std::string input_ssl_option = "SSL_OP_MSIE_SSLV2_RSA_PADDING";
+    
+        long int return_ssl_option = vs->conv_ssl_option(input_ssl_option);
+    
+        //! SSL_OP_MSIE_SSLV2_RSA_PADDING option
+        // unit_test[94] conv_ssl_option check
+        BOOST_CHECK_EQUAL( return_ssl_option, SSL_OP_MSIE_SSLV2_RSA_PADDING );
+    
+    }
+
+    std::cout << "conv_ssl_option SSL_OP_SSLEAY_080_CLIENT_DH_BUG case" << std::endl;
+    // conv_ssl_option SSL_OP_SSLEAY_080_CLIENT_DH_BUG case
+    {
+        std::string input_ssl_option = "SSL_OP_SSLEAY_080_CLIENT_DH_BUG";
+    
+        long int return_ssl_option = vs->conv_ssl_option(input_ssl_option);
+    
+        //! SSL_OP_SSLEAY_080_CLIENT_DH_BUG option
+        // unit_test[95] conv_ssl_option check
+        BOOST_CHECK_EQUAL( return_ssl_option, SSL_OP_SSLEAY_080_CLIENT_DH_BUG );
+    
+    }
+
+    std::cout << "conv_ssl_option SSL_OP_TLS_D5_BUG case" << std::endl;
+    // conv_ssl_option SSL_OP_TLS_D5_BUG case
+    {
+        std::string input_ssl_option = "SSL_OP_TLS_D5_BUG";
+    
+        long int return_ssl_option = vs->conv_ssl_option(input_ssl_option);
+    
+        //! SSL_OP_TLS_D5_BUG option
+        // unit_test[96] conv_ssl_option check
+        BOOST_CHECK_EQUAL( return_ssl_option, SSL_OP_TLS_D5_BUG );
+    
+    }
+
+    std::cout << "conv_ssl_option SSL_OP_TLS_BLOCK_PADDING_BUG case" << std::endl;
+    // conv_ssl_option SSL_OP_TLS_BLOCK_PADDING_BUG case
+    {
+        std::string input_ssl_option = "SSL_OP_TLS_BLOCK_PADDING_BUG";
+    
+        long int return_ssl_option = vs->conv_ssl_option(input_ssl_option);
+    
+        //! SSL_OP_TLS_BLOCK_PADDING_BUG option
+        // unit_test[97] conv_ssl_option check
+        BOOST_CHECK_EQUAL( return_ssl_option, SSL_OP_TLS_BLOCK_PADDING_BUG );
+    
+    }
+
+    std::cout << "conv_ssl_option SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS case" << std::endl;
+    // conv_ssl_option SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS case
+    {
+        std::string input_ssl_option = "SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS";
+    
+        long int return_ssl_option = vs->conv_ssl_option(input_ssl_option);
+    
+        //! SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS option
+        // unit_test[98] conv_ssl_option check
+        BOOST_CHECK_EQUAL( return_ssl_option, SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS );
+    
+    }
+
+    std::cout << "conv_ssl_option SSL_OP_ALL case" << std::endl;
+    // conv_ssl_option SSL_OP_ALL case
+    {
+        std::string input_ssl_option = "SSL_OP_ALL";
+    
+        long int return_ssl_option = vs->conv_ssl_option(input_ssl_option);
+    
+        //! SSL_OP_ALL option
+        // unit_test[99] conv_ssl_option check
+        BOOST_CHECK_EQUAL( return_ssl_option, SSL_OP_ALL );
+    
+    }
+
+    std::cout << "conv_ssl_option SSL_OP_NO_QUERY_MTU case" << std::endl;
+    // conv_ssl_option SSL_OP_NO_QUERY_MTU case
+    {
+        std::string input_ssl_option = "SSL_OP_NO_QUERY_MTU";
+    
+        long int return_ssl_option = vs->conv_ssl_option(input_ssl_option);
+    
+        //! SSL_OP_NO_QUERY_MTU option
+        // unit_test[100] conv_ssl_option check
+        BOOST_CHECK_EQUAL( return_ssl_option, SSL_OP_NO_QUERY_MTU );
+    
+    }
+
+    std::cout << "conv_ssl_option SSL_OP_COOKIE_EXCHANGE case" << std::endl;
+    // conv_ssl_option SSL_OP_COOKIE_EXCHANGE case
+    {
+        std::string input_ssl_option = "SSL_OP_COOKIE_EXCHANGE";
+    
+        long int return_ssl_option = vs->conv_ssl_option(input_ssl_option);
+    
+        //! SSL_OP_COOKIE_EXCHANGE option
+        // unit_test[101] conv_ssl_option check
+        BOOST_CHECK_EQUAL( return_ssl_option, SSL_OP_COOKIE_EXCHANGE );
+    
+    }
+
+    std::cout << "conv_ssl_option SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION case" << std::endl;
+    // conv_ssl_option SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION case
+    {
+        std::string input_ssl_option = "SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION";
+    
+        long int return_ssl_option = vs->conv_ssl_option(input_ssl_option);
+    
+        //! SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION option
+        // unit_test[102] conv_ssl_option check
+        BOOST_CHECK_EQUAL( return_ssl_option, SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION );
+    
+    }
+
+    std::cout << "conv_ssl_option SSL_OP_SINGLE_ECDH_USE case" << std::endl;
+    // conv_ssl_option SSL_OP_SINGLE_ECDH_USE case
+    {
+        std::string input_ssl_option = "SSL_OP_SINGLE_ECDH_USE";
+    
+        long int return_ssl_option = vs->conv_ssl_option(input_ssl_option);
+    
+        //! SSL_OP_SINGLE_ECDH_USE option
+        // unit_test[103] conv_ssl_option check
+        BOOST_CHECK_EQUAL( return_ssl_option, SSL_OP_SINGLE_ECDH_USE );
+    
+    }
+
+    std::cout << "conv_ssl_option SSL_OP_SINGLE_DH_USE case" << std::endl;
+    // conv_ssl_option SSL_OP_SINGLE_DH_USE case
+    {
+        std::string input_ssl_option = "SSL_OP_SINGLE_DH_USE";
+    
+        long int return_ssl_option = vs->conv_ssl_option(input_ssl_option);
+    
+        //! SSL_OP_SINGLE_DH_USE option
+        // unit_test[104] conv_ssl_option check
+        BOOST_CHECK_EQUAL( return_ssl_option, SSL_OP_SINGLE_DH_USE );
+    
+    }
+
+    std::cout << "conv_ssl_option SSL_OP_EPHEMERAL_RSA case" << std::endl;
+    // conv_ssl_option SSL_OP_EPHEMERAL_RSA case
+    {
+        std::string input_ssl_option = "SSL_OP_EPHEMERAL_RSA";
+    
+        long int return_ssl_option = vs->conv_ssl_option(input_ssl_option);
+    
+        //! SSL_OP_EPHEMERAL_RSA option
+        // unit_test[105] conv_ssl_option check
+        BOOST_CHECK_EQUAL( return_ssl_option, SSL_OP_EPHEMERAL_RSA );
+    
+    }
+
+    std::cout << "conv_ssl_option SSL_OP_CIPHER_SERVER_PREFERENCE case" << std::endl;
+    // conv_ssl_option SSL_OP_CIPHER_SERVER_PREFERENCE case
+    {
+        std::string input_ssl_option = "SSL_OP_CIPHER_SERVER_PREFERENCE";
+    
+        long int return_ssl_option = vs->conv_ssl_option(input_ssl_option);
+    
+        //! SSL_OP_CIPHER_SERVER_PREFERENCE option
+        // unit_test[106] conv_ssl_option check
+        BOOST_CHECK_EQUAL( return_ssl_option, SSL_OP_CIPHER_SERVER_PREFERENCE );
+    
+    }
+
+    std::cout << "conv_ssl_option SSL_OP_TLS_ROLLBACK_BUG case" << std::endl;
+    // conv_ssl_option SSL_OP_TLS_ROLLBACK_BUG case
+    {
+        std::string input_ssl_option = "SSL_OP_TLS_ROLLBACK_BUG";
+    
+        long int return_ssl_option = vs->conv_ssl_option(input_ssl_option);
+    
+        //! SSL_OP_TLS_ROLLBACK_BUG option
+        // unit_test[107] conv_ssl_option check
+        BOOST_CHECK_EQUAL( return_ssl_option, SSL_OP_TLS_ROLLBACK_BUG );
+    
+    }
+
+    std::cout << "conv_ssl_option SSL_OP_NO_SSLv2 case" << std::endl;
+    // conv_ssl_option SSL_OP_NO_SSLv2 case
+    {
+        std::string input_ssl_option = "SSL_OP_NO_SSLv2";
+    
+        long int return_ssl_option = vs->conv_ssl_option(input_ssl_option);
+    
+        //! SSL_OP_NO_SSLv2 option
+        // unit_test[108] conv_ssl_option check
+        BOOST_CHECK_EQUAL( return_ssl_option, SSL_OP_NO_SSLv2 );
+    
+    }
+
+    std::cout << "conv_ssl_option SSL_OP_NO_SSLv3 case" << std::endl;
+    // conv_ssl_option SSL_OP_NO_SSLv3 case
+    {
+        std::string input_ssl_option = "SSL_OP_NO_SSLv3";
+    
+        long int return_ssl_option = vs->conv_ssl_option(input_ssl_option);
+    
+        //! SSL_OP_NO_SSLv3 option
+        // unit_test[109] conv_ssl_option check
+        BOOST_CHECK_EQUAL( return_ssl_option, SSL_OP_NO_SSLv3 );
+    
+    }
+
+
+    std::cout << "conv_ssl_option SSL_OP_NO_TLSv1 case" << std::endl;
+    // conv_ssl_option SSL_OP_NO_TLSv1 case
+    {
+        std::string input_ssl_option = "SSL_OP_NO_TLSv1";
+    
+        long int return_ssl_option = vs->conv_ssl_option(input_ssl_option);
+    
+        //! SSL_OP_NO_TLSv1 option
+        // unit_test[110] conv_ssl_option check
+        BOOST_CHECK_EQUAL( return_ssl_option, SSL_OP_NO_TLSv1 );
+    
+    }
+
+    std::cout << "conv_ssl_option SSL_OP_PKCS1_CHECK_1 case" << std::endl;
+    // conv_ssl_option SSL_OP_PKCS1_CHECK_1 case
+    {
+        std::string input_ssl_option = "SSL_OP_PKCS1_CHECK_1";
+    
+        long int return_ssl_option = vs->conv_ssl_option(input_ssl_option);
+    
+        //! SSL_OP_PKCS1_CHECK_1 option
+        // unit_test[111] conv_ssl_option check
+        BOOST_CHECK_EQUAL( return_ssl_option, SSL_OP_PKCS1_CHECK_1 );
+    
+    }
+
+    std::cout << "conv_ssl_option SSL_OP_PKCS1_CHECK_2 case" << std::endl;
+    // conv_ssl_option SSL_OP_PKCS1_CHECK_2 case
+    {
+        std::string input_ssl_option = "SSL_OP_PKCS1_CHECK_2";
+    
+        long int return_ssl_option = vs->conv_ssl_option(input_ssl_option);
+    
+        //! SSL_OP_PKCS1_CHECK_2 option
+        // unit_test[112] conv_ssl_option check
+        BOOST_CHECK_EQUAL( return_ssl_option, SSL_OP_PKCS1_CHECK_2 );
+    
+    }
+
+    std::cout << "conv_ssl_option SSL_OP_NETSCAPE_CA_DN_BUG case" << std::endl;
+    // conv_ssl_option SSL_OP_NETSCAPE_CA_DN_BUG case
+    {
+        std::string input_ssl_option = "SSL_OP_NETSCAPE_CA_DN_BUG";
+    
+        long int return_ssl_option = vs->conv_ssl_option(input_ssl_option);
+    
+        //! SSL_OP_NETSCAPE_CA_DN_BUG option
+        // unit_test[113] conv_ssl_option check
+        BOOST_CHECK_EQUAL( return_ssl_option, SSL_OP_NETSCAPE_CA_DN_BUG );
+    
+    }
+
+    std::cout << "conv_ssl_option SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG case" << std::endl;
+    // conv_ssl_option SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG case
+    {
+        std::string input_ssl_option = "SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG";
+    
+        long int return_ssl_option = vs->conv_ssl_option(input_ssl_option);
+    
+        //! SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG option
+        // unit_test[114] conv_ssl_option check
+        BOOST_CHECK_EQUAL( return_ssl_option, SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG );
+    
+    }
+
+    std::cout << "conv_ssl_option error case" << std::endl;
+    // conv_ssl_option error case
+    {
+        std::string input_ssl_option = "error";
+    
+        long int return_ssl_option = vs->conv_ssl_option(input_ssl_option);
+    
+        //! error option
+        // unit_test[115] conv_ssl_option check
+        BOOST_CHECK_EQUAL( return_ssl_option, -1 );
+    
+    }
+
+    BOOST_MESSAGE( "-------??" );
+    delete vs;
+
+}
+
+// get_ssl_parameter test sub func
+void virtualservice_tcp_get_ssl_parameter_clear( l7vs::vs_tcp* vs ){
+    std::string empty_data = "";
+    int err_data = -1;
+
+    // read param clear
+    vs->set_ca_dir(empty_data);
+    vs->set_ca_file(empty_data);
+    vs->set_cert_chain_dir(empty_data);
+    vs->set_cert_chain_file(empty_data);
+    vs->set_private_key_dir(empty_data);
+    vs->set_private_key_file(empty_data);
+    vs->set_private_key_filetype(DEFAULT_SSL_PRIVATE_KEY_FILETYPE);
+    vs->set_private_key_passwd_dir(empty_data);
+    vs->set_private_key_passwd_file(empty_data);
+    vs->set_verify_options(0);
+    vs->set_verify_cert_depth(err_data);
+    vs->set_ssl_options(0);
+    vs->set_is_tmp_dh_use(false);
+    vs->set_tmp_dh_dir(empty_data);
+    vs->set_tmp_dh_file(empty_data);
+    vs->set_cipher_list(empty_data);
+    vs->set_is_session_cache_use(false);
+    vs->set_session_cache_mode(err_data);
+    vs->set_session_cache_size(err_data);
+    vs->set_session_cache_timeout(err_data);
+    vs->set_handshake_timeout(err_data);
+    vs->set_ssl_file_name(empty_data);
+
+}
+
+// get_ssl_parameter test
+void virtualservice_tcp_get_ssl_parameter(){
+    counter = 1;
+
+    debugg_flug_struct::getInstance().pmcontrol_err_flag() = false;
+    debugg_flug_struct::getInstance().smcontrol_err_flag() = false;
+    debugg_flug_struct::getInstance().param_exist_flag()   = false;
+
+    l7vs::l7vsd                    vsd;
+    boost::asio::io_service        dispatcher;
+    l7vs::replication              rep;
+    l7vs::virtualservice_element   element;
+    //set element value
+    element.udpmode                = false;
+    element.tcp_accept_endpoint    = tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    element.udp_recv_endpoint      = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    element.realserver_vector.clear();
+    element.protocol_module_name   = "PMtest1";
+    element.schedule_module_name   = "SMtest1";
+    element.protocol_args.clear();
+    element.protocol_args.push_back( "testarg" );
+    element.protocol_args.push_back( "testarg2" );
+    element.sorry_maxconnection    = 1234LL;
+    element.sorry_endpoint         = tcp_ep_type( boost::asio::ip::address::from_string( "10.144.169.87" ), (8080) );
+    element.sorry_flag             = false;
+    element.qos_upstream           = 65535ULL;
+    element.qos_downstream         = 32767ULL;
+
+    l7vs::vs_tcp*    vs = new l7vs::vs_tcp( vsd, rep, element );
+
+    BOOST_CHECK_EQUAL( &vsd, &(vs->get_vsd()) );
+    BOOST_CHECK_EQUAL( &rep, &(vs->get_rep()) );
+    BOOST_CHECK( element == vs->get_element() );
+
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "get_ssl_parameter normal case01" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    // get_ssl_parameter normal case01
+    {
+        // create config file
+        std::string input_ca_dir = "/home/komata/KomataCA/";
+        std::string input_ca_file = "CAfile.pem";
+        std::string input_cert_chain_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_cert_chain_file = "cert.pem";
+        std::string input_private_key_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_file = "server.key";
+        std::string input_private_key_filetype = "SSL_FILETYPE_PEM";
+        std::string input_private_key_passwd_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_passwd_file = "passwd.txt";
+        int         input_verify_options = (SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT);
+        int         input_verify_cert_depth = 4;
+        long int    input_ssl_options = (SSL_OP_ALL | SSL_OP_NO_SSLv2 | SSL_OP_SINGLE_DH_USE);
+        bool        input_is_tmp_dh_use = true;  // SSL_OP_SINGLE_DH_USE true
+        std::string input_tmp_dh_dir = "/home/komata/KomataCA/";
+        std::string input_tmp_dh_file = "dh512.pem";
+        std::string input_cipher_list = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH";
+        bool        input_is_session_cache_use = true;
+        long        input_session_cache_mode = (SSL_SESS_CACHE_SERVER | SSL_SESS_CACHE_NO_AUTO_CLEAR);
+        long        input_session_cache_size = 20480;
+        long        input_session_cache_timeout = 300;
+        int         input_handshake_timeout = 30;
+
+        std::string       ssl_passwd           = "test";
+        std::string       ssl_passwd_dir       = "./sslfiles/";
+        std::string       ssl_passwd_file      = "ssl_password_file01.cf";
+        std::string       ssl_passwd_full_path = ssl_passwd_dir + ssl_passwd_file;
+
+        std::ofstream     ofs( ssl_passwd_full_path.c_str() );
+
+        ofs << "[ssl]\n";
+        ofs << "ca_dir=\""                  << input_ca_dir << "\"\n";
+        ofs << "ca_file=\""                 << input_ca_file << "\"\n";
+        ofs << "cert_chain_dir=\""          << input_cert_chain_dir << "\"\n";
+        ofs << "cert_chain_file=\""         << input_cert_chain_file << "\"\n";
+        ofs << "private_key_dir=\""         << input_private_key_dir << "\"\n";
+        ofs << "private_key_file=\""        << input_private_key_file << "\"\n";
+        ofs << "private_key_filetype=\""    << input_private_key_filetype << "\"\n";
+        ofs << "private_key_passwd_dir=\""  << input_private_key_passwd_dir << "\"\n";
+        ofs << "private_key_passwd_file=\"" << input_private_key_passwd_file << "\"\n";
+        ofs << "verify_options=\""          << "SSL_VERIFY_PEER" << "\"\n";
+        ofs << "verify_options=\""          << "SSL_VERIFY_FAIL_IF_NO_PEER_CERT" << "\"\n";
+        ofs << "verify_cert_depth="         << input_verify_cert_depth << "\n";
+        ofs << "ssl_options=\""             << "SSL_OP_ALL" << "\"\n";
+        ofs << "ssl_options=\""             << "SSL_OP_NO_SSLv2" << "\"\n";
+        ofs << "ssl_options=\""             << "SSL_OP_SINGLE_DH_USE" << "\"\n";
+        ofs << "tmp_dh_dir=\""              << input_tmp_dh_dir << "\"\n";
+        ofs << "tmp_dh_file=\""             << input_tmp_dh_file << "\"\n";
+        ofs << "cipher_list=\""             << input_cipher_list << "\"\n";
+        ofs << "session_cache=\""           << "on" << "\"\n";
+        ofs << "session_cache_size="        << input_session_cache_size << "\n";
+        ofs << "session_cache_timeout="     << input_session_cache_timeout << "\n";
+        ofs << "timeout_sec="               << input_handshake_timeout << "\n";
+
+        ofs.close();
+
+        vs->set_ssl_file_name(ssl_passwd_full_path);
+
+        // unit_test[116] get_ssl_parameter normal case01
+        bool return_ssl_config = vs->get_ssl_parameter();
+
+        BOOST_CHECK_EQUAL( return_ssl_config, true );
+        BOOST_CHECK_EQUAL( vs->get_ca_dir() , input_ca_dir );
+        BOOST_CHECK_EQUAL( vs->get_ca_file() , input_ca_file );
+        BOOST_CHECK_EQUAL( vs->get_cert_chain_dir() , input_cert_chain_dir );
+        BOOST_CHECK_EQUAL( vs->get_cert_chain_file() , input_cert_chain_file );
+        BOOST_CHECK_EQUAL( vs->get_private_key_dir() , input_private_key_dir );
+        BOOST_CHECK_EQUAL( vs->get_private_key_file() , input_private_key_file );
+        BOOST_CHECK( vs->get_private_key_filetype() == boost::asio::ssl::context::pem );
+        BOOST_CHECK_EQUAL( vs->get_private_key_passwd_dir() , input_private_key_passwd_dir );
+        BOOST_CHECK_EQUAL( vs->get_private_key_passwd_file() , input_private_key_passwd_file );
+        BOOST_CHECK_EQUAL( vs->get_verify_options() , input_verify_options );
+        BOOST_CHECK_EQUAL( vs->get_verify_cert_depth() , input_verify_cert_depth );
+        BOOST_CHECK_EQUAL( vs->get_ssl_options() , input_ssl_options );
+        BOOST_CHECK_EQUAL( vs->get_is_tmp_dh_use() , input_is_tmp_dh_use );
+        BOOST_CHECK_EQUAL( vs->get_tmp_dh_dir() , input_tmp_dh_dir );
+        BOOST_CHECK_EQUAL( vs->get_tmp_dh_file() , input_tmp_dh_file );
+        BOOST_CHECK_EQUAL( vs->get_cipher_list() , input_cipher_list );
+        BOOST_CHECK_EQUAL( vs->get_is_session_cache_use() , input_is_session_cache_use );
+        BOOST_CHECK_EQUAL( vs->get_session_cache_mode() , input_session_cache_mode );
+        BOOST_CHECK_EQUAL( vs->get_session_cache_size() , input_session_cache_size );
+        BOOST_CHECK_EQUAL( vs->get_session_cache_timeout() , input_session_cache_timeout );
+        BOOST_CHECK_EQUAL( vs->get_handshake_timeout() , input_handshake_timeout );
+
+        unlink( ssl_passwd_full_path.c_str() );
+
+    }
+
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "get_ssl_parameter normal case02 default data(err default root)" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    // get_ssl_parameter normal case02 default data(err default root)
+    {
+        // read parameter clear
+        virtualservice_tcp_get_ssl_parameter_clear(vs);
+
+//        std::string input_ca_dir = "/home/komata/KomataCA/";
+        std::string input_ca_file = "CAfile.pem";
+//        std::string input_cert_chain_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_cert_chain_file = "cert.pem";
+//        std::string input_private_key_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_file = "server.key";
+//        std::string input_private_key_filetype = "SSL_FILETYPE_PEM";
+//        std::string input_private_key_passwd_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_passwd_file = "passwd.txt";
+//        int         input_verify_options = (SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT);
+//        int         input_verify_cert_depth = 4;
+//        long int    input_ssl_options = (SSL_OP_ALL | SSL_OP_NO_SSLv2 | SSL_OP_SINGLE_DH_USE);
+        bool        input_is_tmp_dh_use = true;  // SSL_OP_SINGLE_DH_USE or defalut root is true
+//        std::string input_tmp_dh_dir = "/home/komata/KomataCA/";
+        std::string input_tmp_dh_file = "dh512.pem";
+//        std::string input_cipher_list = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH";
+        bool        input_is_session_cache_use = true; // "on" deffault root is true
+//        long        input_session_cache_mode = (SSL_SESS_CACHE_SERVER | SSL_SESS_CACHE_NO_AUTO_CLEAR);
+//        long        input_session_cache_size = 20480;
+//        long        input_session_cache_timeout = 300;
+//        int         input_handshake_timeout = 30;
+
+        std::string  ssl_passwd           = "test";
+        std::string  ssl_passwd_dir       = "./sslfiles/";
+        std::string  ssl_passwd_file      = "ssl_password_file02.cf";
+        std::string  ssl_passwd_full_path = ssl_passwd_dir + ssl_passwd_file;
+
+        std::ofstream ofs( ssl_passwd_full_path.c_str() );
+
+        ofs << "[ssl]\n";
+        ofs << "ca_file=\""                 << input_ca_file << "\"\n";
+        ofs << "cert_chain_file=\""         << input_cert_chain_file << "\"\n";
+        ofs << "private_key_file=\""        << input_private_key_file << "\"\n";
+        ofs << "private_key_passwd_file=\"" << input_private_key_passwd_file << "\"\n";
+        ofs << "tmp_dh_file=\""             << input_tmp_dh_file << "\"\n";
+
+        ofs.close();
+
+        vs->set_ssl_file_name(ssl_passwd_full_path);
+
+        // unit_test[117] get_ssl_parameter normal case02 default data(err default root)
+        bool return_ssl_config = vs->get_ssl_parameter();
+
+        BOOST_CHECK_EQUAL( return_ssl_config, true );
+        BOOST_CHECK_EQUAL( vs->get_ca_dir() , DEFAULT_SSL_CA_DIR );
+        BOOST_CHECK_EQUAL( vs->get_ca_file() , input_ca_file );
+        BOOST_CHECK_EQUAL( vs->get_cert_chain_dir() , DEFAULT_SSL_CERT_CHAIN_DIR );
+        BOOST_CHECK_EQUAL( vs->get_cert_chain_file() , input_cert_chain_file );
+        BOOST_CHECK_EQUAL( vs->get_private_key_dir() , DEFAULT_SSL_PRIVATE_KEY_DIR );
+        BOOST_CHECK_EQUAL( vs->get_private_key_file() , input_private_key_file );
+        BOOST_CHECK( vs->get_private_key_filetype() == DEFAULT_SSL_PRIVATE_KEY_FILETYPE );
+        BOOST_CHECK_EQUAL( vs->get_private_key_passwd_dir() , DEFAULT_SSL_PRIVATE_KEY_PASSWD_DIR );
+        BOOST_CHECK_EQUAL( vs->get_private_key_passwd_file() , input_private_key_passwd_file );
+        BOOST_CHECK_EQUAL( vs->get_verify_options() , DEFAULT_SSL_VERIFY_OPTIONS );
+        BOOST_CHECK_EQUAL( vs->get_verify_cert_depth() , DEFAULT_SSL_VERIFY_CERT_DEPTH );
+        BOOST_CHECK_EQUAL( vs->get_ssl_options() , DEFAULT_SSL_OPTIONS );
+        BOOST_CHECK_EQUAL( vs->get_is_tmp_dh_use() , input_is_tmp_dh_use );
+        BOOST_CHECK_EQUAL( vs->get_tmp_dh_dir() , DEFAULT_SSL_TMP_DH_DIR );
+        BOOST_CHECK_EQUAL( vs->get_tmp_dh_file() , input_tmp_dh_file );
+        BOOST_CHECK_EQUAL( vs->get_cipher_list() , DEFAULT_SSL_CIPHER_LIST );
+        BOOST_CHECK_EQUAL( vs->get_is_session_cache_use() , input_is_session_cache_use );
+        BOOST_CHECK_EQUAL( vs->get_session_cache_mode() , DEFAULT_SSL_SESSION_CACHE_MODE );
+        BOOST_CHECK_EQUAL( vs->get_session_cache_size() , DEFAULT_SSL_SESSION_CACHE_SIZE );
+        BOOST_CHECK_EQUAL( vs->get_session_cache_timeout() , DEFAULT_SSL_SESSION_CACHE_TIMEOUT );
+        BOOST_CHECK_EQUAL( vs->get_handshake_timeout() , DEFAULT_SSL_HANDSHAKE_TIMEOUT );
+
+        unlink( ssl_passwd_full_path.c_str() );
+
+    }
+
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "get_ssl_parameter normal case03 default data(empty default root)" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    // get_ssl_parameter normal case03 default data(empty default root)
+    {
+        // read parameter clear
+        virtualservice_tcp_get_ssl_parameter_clear(vs);
+
+//        std::string input_ca_dir = "/home/komata/KomataCA/";
+        std::string input_ca_file = "CAfile.pem";
+//        std::string input_cert_chain_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_cert_chain_file = "cert.pem";
+//        std::string input_private_key_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_file = "server.key";
+//        std::string input_private_key_filetype = "SSL_FILETYPE_PEM";
+//        std::string input_private_key_passwd_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_passwd_file = "passwd.txt";
+        int         input_verify_options = SSL_VERIFY_PEER;
+        int         input_verify_cert_depth = 4;
+//        long int    input_ssl_options = (SSL_OP_ALL | SSL_OP_NO_SSLv2 | SSL_OP_SINGLE_DH_USE);
+        bool        input_is_tmp_dh_use = true;  // SSL_OP_SINGLE_DH_USE or defalut root is true
+//        std::string input_tmp_dh_dir = "/home/komata/KomataCA/";
+        std::string input_tmp_dh_file = "dh512.pem";
+//        std::string input_cipher_list = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH";
+        bool        input_is_session_cache_use = true; // "on" deffault root is true
+//        long        input_session_cache_mode = (SSL_SESS_CACHE_SERVER | SSL_SESS_CACHE_NO_AUTO_CLEAR);
+        long        input_session_cache_size = 20480;
+        long        input_session_cache_timeout = 300;
+        int         input_handshake_timeout = 30;
+
+        std::string  ssl_passwd           = "test";
+        std::string  ssl_passwd_dir       = "./sslfiles/";
+        std::string  ssl_passwd_file      = "ssl_password_file03.cf";
+        std::string  ssl_passwd_full_path = ssl_passwd_dir + ssl_passwd_file;
+
+        std::ofstream ofs( ssl_passwd_full_path.c_str() );
+
+        ofs << "[ssl]\n";
+        ofs << "ca_dir=\""                  << "\"\n";
+        ofs << "ca_file=\""                 << input_ca_file << "\"\n";
+        ofs << "cert_chain_dir=\""          << "\"\n";
+        ofs << "cert_chain_file=\""         << input_cert_chain_file << "\"\n";
+        ofs << "private_key_dir=\""         << "\"\n";
+        ofs << "private_key_file=\""        << input_private_key_file << "\"\n";
+        ofs << "private_key_filetype=\""    << "\"\n";
+        ofs << "private_key_passwd_dir=\""  << "\"\n";
+        ofs << "private_key_passwd_file=\"" << input_private_key_passwd_file << "\"\n";
+        ofs << "verify_options=\""          << "SSL_VERIFY_PEER" << "\"\n";
+        ofs << "verify_cert_depth="         << input_verify_cert_depth << "\n";
+        ofs << "tmp_dh_dir=\""              << "\"\n";
+        ofs << "tmp_dh_file=\""             << input_tmp_dh_file << "\"\n";
+        ofs << "cipher_list=\""             << "\"\n";
+        ofs << "session_cache=\""           << "\"\n";
+        ofs << "session_cache_size="        << input_session_cache_size << "\n";
+        ofs << "session_cache_timeout="     << input_session_cache_timeout << "\n";
+        ofs << "timeout_sec="               << input_handshake_timeout << "\n";
+
+        ofs.close();
+
+        vs->set_ssl_file_name(ssl_passwd_full_path);
+
+        // unit_test[118] get_ssl_parameter normal case03 default data(empty default root)
+        bool return_ssl_config = vs->get_ssl_parameter();
+
+        BOOST_CHECK_EQUAL( return_ssl_config, true );
+        BOOST_CHECK_EQUAL( vs->get_ca_dir() , DEFAULT_SSL_CA_DIR );
+        BOOST_CHECK_EQUAL( vs->get_ca_file() , input_ca_file );
+        BOOST_CHECK_EQUAL( vs->get_cert_chain_dir() , DEFAULT_SSL_CERT_CHAIN_DIR );
+        BOOST_CHECK_EQUAL( vs->get_cert_chain_file() , input_cert_chain_file );
+        BOOST_CHECK_EQUAL( vs->get_private_key_dir() , DEFAULT_SSL_PRIVATE_KEY_DIR );
+        BOOST_CHECK_EQUAL( vs->get_private_key_file() , input_private_key_file );
+        BOOST_CHECK( vs->get_private_key_filetype() == DEFAULT_SSL_PRIVATE_KEY_FILETYPE );
+        BOOST_CHECK_EQUAL( vs->get_private_key_passwd_dir() , DEFAULT_SSL_PRIVATE_KEY_PASSWD_DIR );
+        BOOST_CHECK_EQUAL( vs->get_private_key_passwd_file() , input_private_key_passwd_file );
+        BOOST_CHECK_EQUAL( vs->get_verify_options() , input_verify_options );
+        BOOST_CHECK_EQUAL( vs->get_verify_cert_depth() , input_verify_cert_depth );
+        BOOST_CHECK_EQUAL( vs->get_ssl_options() , DEFAULT_SSL_OPTIONS );
+        BOOST_CHECK_EQUAL( vs->get_is_tmp_dh_use() , input_is_tmp_dh_use );
+        BOOST_CHECK_EQUAL( vs->get_tmp_dh_dir() , DEFAULT_SSL_TMP_DH_DIR );
+        BOOST_CHECK_EQUAL( vs->get_tmp_dh_file() , input_tmp_dh_file );
+        BOOST_CHECK_EQUAL( vs->get_cipher_list() , DEFAULT_SSL_CIPHER_LIST );
+        BOOST_CHECK_EQUAL( vs->get_is_session_cache_use() , input_is_session_cache_use );
+        BOOST_CHECK_EQUAL( vs->get_session_cache_mode() , DEFAULT_SSL_SESSION_CACHE_MODE );
+        BOOST_CHECK_EQUAL( vs->get_session_cache_size() , input_session_cache_size );
+        BOOST_CHECK_EQUAL( vs->get_session_cache_timeout() , input_session_cache_timeout );
+        BOOST_CHECK_EQUAL( vs->get_handshake_timeout() , input_handshake_timeout );
+
+        unlink( ssl_passwd_full_path.c_str() );
+
+    }
+
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "get_ssl_parameter normal case04 (filetype_str,cache_str variation)" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    // get_ssl_parameter normal case04 (filetype_str,cache_str variation)
+    {
+        // read parameter clear
+        virtualservice_tcp_get_ssl_parameter_clear(vs);
+
+        // create config file
+        std::string input_ca_dir = "/home/komata/KomataCA/";
+        std::string input_ca_file = "CAfile.pem";
+        std::string input_cert_chain_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_cert_chain_file = "cert.pem";
+        std::string input_private_key_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_file = "server.key";
+        std::string input_private_key_filetype = "SSL_FILETYPE_ASN1";
+        std::string input_private_key_passwd_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_passwd_file = "passwd.txt";
+        int         input_verify_options = (SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT);
+        int         input_verify_cert_depth = 4;
+        long int    input_ssl_options = (SSL_OP_ALL | SSL_OP_NO_SSLv2 | SSL_OP_SINGLE_DH_USE);
+        bool        input_is_tmp_dh_use = true;  // SSL_OP_SINGLE_DH_USE true
+        std::string input_tmp_dh_dir = "/home/komata/KomataCA/";
+        std::string input_tmp_dh_file = "dh512.pem";
+        std::string input_cipher_list = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH";
+        bool        input_is_session_cache_use = false;
+        int         input_handshake_timeout = 30;
+
+        std::string       ssl_passwd           = "test";
+        std::string       ssl_passwd_dir       = "./sslfiles/";
+        std::string       ssl_passwd_file      = "ssl_password_file04.cf";
+        std::string       ssl_passwd_full_path = ssl_passwd_dir + ssl_passwd_file;
+
+        std::ofstream     ofs( ssl_passwd_full_path.c_str() );
+
+        ofs << "[ssl]\n";
+        ofs << "ca_dir=\""                  << input_ca_dir << "\"\n";
+        ofs << "ca_file=\""                 << input_ca_file << "\"\n";
+        ofs << "cert_chain_dir=\""          << input_cert_chain_dir << "\"\n";
+        ofs << "cert_chain_file=\""         << input_cert_chain_file << "\"\n";
+        ofs << "private_key_dir=\""         << input_private_key_dir << "\"\n";
+        ofs << "private_key_file=\""        << input_private_key_file << "\"\n";
+        ofs << "private_key_filetype=\""    << input_private_key_filetype << "\"\n";
+        ofs << "private_key_passwd_dir=\""  << input_private_key_passwd_dir << "\"\n";
+        ofs << "private_key_passwd_file=\"" << input_private_key_passwd_file << "\"\n";
+        ofs << "verify_options=\""          << "SSL_VERIFY_PEER" << "\"\n";
+        ofs << "verify_options=\""          << "SSL_VERIFY_FAIL_IF_NO_PEER_CERT" << "\"\n";
+        ofs << "verify_cert_depth="         << input_verify_cert_depth << "\n";
+        ofs << "ssl_options=\""             << "SSL_OP_ALL" << "\"\n";
+        ofs << "ssl_options=\""             << "SSL_OP_NO_SSLv2" << "\"\n";
+        ofs << "ssl_options=\""             << "SSL_OP_SINGLE_DH_USE" << "\"\n";
+        ofs << "tmp_dh_dir=\""              << input_tmp_dh_dir << "\"\n";
+        ofs << "tmp_dh_file=\""             << input_tmp_dh_file << "\"\n";
+        ofs << "cipher_list=\""             << input_cipher_list << "\"\n";
+        ofs << "session_cache=\""           << "off" << "\"\n";
+        ofs << "timeout_sec="               << input_handshake_timeout << "\n";
+
+        ofs.close();
+
+        vs->set_ssl_file_name(ssl_passwd_full_path);
+
+        // unit_test[119] get_ssl_parameter normal case04 (filetype_str,cache_str variation)
+        bool return_ssl_config = vs->get_ssl_parameter();
+
+        BOOST_CHECK_EQUAL( return_ssl_config, true );
+        BOOST_CHECK_EQUAL( vs->get_ca_dir() , input_ca_dir );
+        BOOST_CHECK_EQUAL( vs->get_ca_file() , input_ca_file );
+        BOOST_CHECK_EQUAL( vs->get_cert_chain_dir() , input_cert_chain_dir );
+        BOOST_CHECK_EQUAL( vs->get_cert_chain_file() , input_cert_chain_file );
+        BOOST_CHECK_EQUAL( vs->get_private_key_dir() , input_private_key_dir );
+        BOOST_CHECK_EQUAL( vs->get_private_key_file() , input_private_key_file );
+        BOOST_CHECK( vs->get_private_key_filetype() == boost::asio::ssl::context::asn1 );
+        BOOST_CHECK_EQUAL( vs->get_private_key_passwd_dir() , input_private_key_passwd_dir );
+        BOOST_CHECK_EQUAL( vs->get_private_key_passwd_file() , input_private_key_passwd_file );
+        BOOST_CHECK_EQUAL( vs->get_verify_options() , input_verify_options );
+        BOOST_CHECK_EQUAL( vs->get_verify_cert_depth() , input_verify_cert_depth );
+        BOOST_CHECK_EQUAL( vs->get_ssl_options() , input_ssl_options );
+        BOOST_CHECK_EQUAL( vs->get_is_tmp_dh_use() , input_is_tmp_dh_use );
+        BOOST_CHECK_EQUAL( vs->get_tmp_dh_dir() , input_tmp_dh_dir );
+        BOOST_CHECK_EQUAL( vs->get_tmp_dh_file() , input_tmp_dh_file );
+        BOOST_CHECK_EQUAL( vs->get_cipher_list() , input_cipher_list );
+        BOOST_CHECK_EQUAL( vs->get_is_session_cache_use() , input_is_session_cache_use );
+        BOOST_CHECK_EQUAL( vs->get_handshake_timeout() , input_handshake_timeout );
+
+        unlink( ssl_passwd_full_path.c_str() );
+
+    }
+
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "get_ssl_parameter err (no file)" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    // get_ssl_parameter err (no file)
+    {
+        // read parameter clear
+        virtualservice_tcp_get_ssl_parameter_clear(vs);
+
+        std::string       ssl_passwd           = "test";
+        std::string       ssl_passwd_dir       = "./sslfiles/";
+        std::string       ssl_passwd_file      = "ssl_password_file05.cf";
+        std::string       ssl_passwd_full_path = ssl_passwd_dir + ssl_passwd_file;
+
+        vs->set_ssl_file_name(ssl_passwd_full_path);
+
+        // unit_test[120] get_ssl_parameter err (no file)
+        bool return_ssl_config = vs->get_ssl_parameter();
+
+        BOOST_CHECK_EQUAL( return_ssl_config, false );
+    }
+
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "get_ssl_parameter err (ca_file err)" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    // get_ssl_parameter err (ca_file err)
+    {
+        // read parameter clear
+        virtualservice_tcp_get_ssl_parameter_clear(vs);
+
+//        std::string input_ca_dir = "/home/komata/KomataCA/";
+//!        std::string input_ca_file = "CAfile.pem";
+//        std::string input_cert_chain_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_cert_chain_file = "cert.pem";
+//        std::string input_private_key_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_file = "server.key";
+//        std::string input_private_key_filetype = "SSL_FILETYPE_PEM";
+//        std::string input_private_key_passwd_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_passwd_file = "passwd.txt";
+//        int         input_verify_options = (SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT);
+//        int         input_verify_cert_depth = 4;
+//        long int    input_ssl_options = (SSL_OP_ALL | SSL_OP_NO_SSLv2 | SSL_OP_SINGLE_DH_USE);
+//        bool        input_is_tmp_dh_use = true;  // SSL_OP_SINGLE_DH_USE or defalut root is true
+//        std::string input_tmp_dh_dir = "/home/komata/KomataCA/";
+        std::string input_tmp_dh_file = "dh512.pem";
+//        std::string input_cipher_list = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH";
+//        bool        input_is_session_cache_use = true; // "on" deffault root is true
+//        long        input_session_cache_mode = (SSL_SESS_CACHE_SERVER | SSL_SESS_CACHE_NO_AUTO_CLEAR);
+//        long        input_session_cache_size = 20480;
+//        long        input_session_cache_timeout = 300;
+//        int         input_handshake_timeout = 30;
+
+        std::string  ssl_passwd           = "test";
+        std::string  ssl_passwd_dir       = "./sslfiles/";
+        std::string  ssl_passwd_file      = "ssl_password_file06.cf";
+        std::string  ssl_passwd_full_path = ssl_passwd_dir + ssl_passwd_file;
+
+        std::ofstream ofs( ssl_passwd_full_path.c_str() );
+
+        ofs << "[ssl]\n";
+//!        ofs << "ca_file=\""                 << input_ca_file << "\"\n";
+        ofs << "cert_chain_file=\""         << input_cert_chain_file << "\"\n";
+        ofs << "private_key_file=\""        << input_private_key_file << "\"\n";
+        ofs << "private_key_passwd_file=\"" << input_private_key_passwd_file << "\"\n";
+        ofs << "tmp_dh_file=\""             << input_tmp_dh_file << "\"\n";
+
+        ofs.close();
+
+        vs->set_ssl_file_name(ssl_passwd_full_path);
+
+        // unit_test[121] get_ssl_parameter check(ca_file err)
+        bool return_ssl_config = vs->get_ssl_parameter();
+
+        BOOST_CHECK_EQUAL( return_ssl_config, false );
+
+        unlink( ssl_passwd_full_path.c_str() );
+
+    }
+
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "get_ssl_parameter err (cert_chain_file err)" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    // get_ssl_parameter err (cert_chain_file err)
+    {
+        // read parameter clear
+        virtualservice_tcp_get_ssl_parameter_clear(vs);
+
+//        std::string input_ca_dir = "/home/komata/KomataCA/";
+        std::string input_ca_file = "CAfile.pem";
+//        std::string input_cert_chain_dir = "/home/komata/KomataCA/SERVER/";
+//!        std::string input_cert_chain_file = "cert.pem";
+//        std::string input_private_key_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_file = "server.key";
+//        std::string input_private_key_filetype = "SSL_FILETYPE_PEM";
+//        std::string input_private_key_passwd_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_passwd_file = "passwd.txt";
+//        int         input_verify_options = (SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT);
+//        int         input_verify_cert_depth = 4;
+//        long int    input_ssl_options = (SSL_OP_ALL | SSL_OP_NO_SSLv2 | SSL_OP_SINGLE_DH_USE);
+//        bool        input_is_tmp_dh_use = true;  // SSL_OP_SINGLE_DH_USE or defalut root is true
+//        std::string input_tmp_dh_dir = "/home/komata/KomataCA/";
+        std::string input_tmp_dh_file = "dh512.pem";
+//        std::string input_cipher_list = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH";
+//        bool        input_is_session_cache_use = true; // "on" deffault root is true
+//        long        input_session_cache_mode = (SSL_SESS_CACHE_SERVER | SSL_SESS_CACHE_NO_AUTO_CLEAR);
+//        long        input_session_cache_size = 20480;
+//        long        input_session_cache_timeout = 300;
+//        int         input_handshake_timeout = 30;
+
+        std::string  ssl_passwd           = "test";
+        std::string  ssl_passwd_dir       = "./sslfiles/";
+        std::string  ssl_passwd_file      = "ssl_password_file07.cf";
+        std::string  ssl_passwd_full_path = ssl_passwd_dir + ssl_passwd_file;
+
+        std::ofstream ofs( ssl_passwd_full_path.c_str() );
+
+        ofs << "[ssl]\n";
+        ofs << "ca_file=\""                 << input_ca_file << "\"\n";
+//!        ofs << "cert_chain_file=\""         << input_cert_chain_file << "\"\n";
+        ofs << "private_key_file=\""        << input_private_key_file << "\"\n";
+        ofs << "private_key_passwd_file=\"" << input_private_key_passwd_file << "\"\n";
+        ofs << "tmp_dh_file=\""             << input_tmp_dh_file << "\"\n";
+
+        ofs.close();
+
+        vs->set_ssl_file_name(ssl_passwd_full_path);
+
+        // unit_test[122] get_ssl_parameter check(cert_chain_file err)
+        bool return_ssl_config = vs->get_ssl_parameter();
+
+        BOOST_CHECK_EQUAL( return_ssl_config, false );
+
+        unlink( ssl_passwd_full_path.c_str() );
+
+    }
+
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "get_ssl_parameter err (cert_chain_file empty)" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    // get_ssl_parameter err (cert_chain_file empty)
+    {
+        // read parameter clear
+        virtualservice_tcp_get_ssl_parameter_clear(vs);
+
+//        std::string input_ca_dir = "/home/komata/KomataCA/";
+        std::string input_ca_file = "CAfile.pem";
+//        std::string input_cert_chain_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_cert_chain_file = "";
+//        std::string input_private_key_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_file = "server.key";
+//        std::string input_private_key_filetype = "SSL_FILETYPE_PEM";
+//        std::string input_private_key_passwd_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_passwd_file = "passwd.txt";
+//        int         input_verify_options = (SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT);
+//        int         input_verify_cert_depth = 4;
+//        long int    input_ssl_options = (SSL_OP_ALL | SSL_OP_NO_SSLv2 | SSL_OP_SINGLE_DH_USE);
+//        bool        input_is_tmp_dh_use = true;  // SSL_OP_SINGLE_DH_USE or defalut root is true
+//        std::string input_tmp_dh_dir = "/home/komata/KomataCA/";
+        std::string input_tmp_dh_file = "dh512.pem";
+//        std::string input_cipher_list = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH";
+//        bool        input_is_session_cache_use = true; // "on" deffault root is true
+//        long        input_session_cache_mode = (SSL_SESS_CACHE_SERVER | SSL_SESS_CACHE_NO_AUTO_CLEAR);
+//        long        input_session_cache_size = 20480;
+//        long        input_session_cache_timeout = 300;
+//        int         input_handshake_timeout = 30;
+
+        std::string  ssl_passwd           = "test";
+        std::string  ssl_passwd_dir       = "./sslfiles/";
+        std::string  ssl_passwd_file      = "ssl_password_file08.cf";
+        std::string  ssl_passwd_full_path = ssl_passwd_dir + ssl_passwd_file;
+
+        std::ofstream ofs( ssl_passwd_full_path.c_str() );
+
+        ofs << "[ssl]\n";
+        ofs << "ca_file=\""                 << input_ca_file << "\"\n";
+        ofs << "cert_chain_file=\""         << input_cert_chain_file << "\"\n";
+        ofs << "private_key_file=\""        << input_private_key_file << "\"\n";
+        ofs << "private_key_passwd_file=\"" << input_private_key_passwd_file << "\"\n";
+        ofs << "tmp_dh_file=\""             << input_tmp_dh_file << "\"\n";
+
+        ofs.close();
+
+        vs->set_ssl_file_name(ssl_passwd_full_path);
+
+        // unit_test[123] get_ssl_parameter check(cert_chain_file empty)
+        bool return_ssl_config = vs->get_ssl_parameter();
+
+        BOOST_CHECK_EQUAL( return_ssl_config, false );
+
+        unlink( ssl_passwd_full_path.c_str() );
+
+    }
+
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "get_ssl_parameter err (private_key_file err)" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    // get_ssl_parameter err (private_key_file err)
+    {
+        // read parameter clear
+        virtualservice_tcp_get_ssl_parameter_clear(vs);
+
+//        std::string input_ca_dir = "/home/komata/KomataCA/";
+        std::string input_ca_file = "CAfile.pem";
+//        std::string input_cert_chain_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_cert_chain_file = "cert.pem";
+//        std::string input_private_key_dir = "/home/komata/KomataCA/SERVER/";
+//!        std::string input_private_key_file = "server.key";
+//        std::string input_private_key_filetype = "SSL_FILETYPE_PEM";
+//        std::string input_private_key_passwd_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_passwd_file = "passwd.txt";
+//        int         input_verify_options = (SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT);
+//        int         input_verify_cert_depth = 4;
+//        long int    input_ssl_options = (SSL_OP_ALL | SSL_OP_NO_SSLv2 | SSL_OP_SINGLE_DH_USE);
+//        bool        input_is_tmp_dh_use = true;  // SSL_OP_SINGLE_DH_USE or defalut root is true
+//        std::string input_tmp_dh_dir = "/home/komata/KomataCA/";
+        std::string input_tmp_dh_file = "dh512.pem";
+//        std::string input_cipher_list = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH";
+//        bool        input_is_session_cache_use = true; // "on" deffault root is true
+//        long        input_session_cache_mode = (SSL_SESS_CACHE_SERVER | SSL_SESS_CACHE_NO_AUTO_CLEAR);
+//        long        input_session_cache_size = 20480;
+//        long        input_session_cache_timeout = 300;
+//        int         input_handshake_timeout = 30;
+
+        std::string  ssl_passwd           = "test";
+        std::string  ssl_passwd_dir       = "./sslfiles/";
+        std::string  ssl_passwd_file      = "ssl_password_file09.cf";
+        std::string  ssl_passwd_full_path = ssl_passwd_dir + ssl_passwd_file;
+
+        std::ofstream ofs( ssl_passwd_full_path.c_str() );
+
+        ofs << "[ssl]\n";
+        ofs << "ca_file=\""                 << input_ca_file << "\"\n";
+        ofs << "cert_chain_file=\""         << input_cert_chain_file << "\"\n";
+//!        ofs << "private_key_file=\""        << input_private_key_file << "\"\n";
+        ofs << "private_key_passwd_file=\"" << input_private_key_passwd_file << "\"\n";
+        ofs << "tmp_dh_file=\""             << input_tmp_dh_file << "\"\n";
+
+        ofs.close();
+
+        vs->set_ssl_file_name(ssl_passwd_full_path);
+
+        // unit_test[124] get_ssl_parameter check(private_key_file err)
+        bool return_ssl_config = vs->get_ssl_parameter();
+
+        BOOST_CHECK_EQUAL( return_ssl_config, false );
+
+        unlink( ssl_passwd_full_path.c_str() );
+
+    }
+
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "get_ssl_parameter err (private_key_file empty)" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    // get_ssl_parameter err (private_key_file empty)
+    {
+        // read parameter clear
+        virtualservice_tcp_get_ssl_parameter_clear(vs);
+
+//        std::string input_ca_dir = "/home/komata/KomataCA/";
+        std::string input_ca_file = "CAfile.pem";
+//        std::string input_cert_chain_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_cert_chain_file = "cert.pem";
+//        std::string input_private_key_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_file = "";
+//        std::string input_private_key_filetype = "SSL_FILETYPE_PEM";
+//        std::string input_private_key_passwd_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_passwd_file = "passwd.txt";
+//        int         input_verify_options = (SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT);
+//        int         input_verify_cert_depth = 4;
+//        long int    input_ssl_options = (SSL_OP_ALL | SSL_OP_NO_SSLv2 | SSL_OP_SINGLE_DH_USE);
+//        bool        input_is_tmp_dh_use = true;  // SSL_OP_SINGLE_DH_USE or defalut root is true
+//        std::string input_tmp_dh_dir = "/home/komata/KomataCA/";
+        std::string input_tmp_dh_file = "dh512.pem";
+//        std::string input_cipher_list = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH";
+//        bool        input_is_session_cache_use = true; // "on" deffault root is true
+//        long        input_session_cache_mode = (SSL_SESS_CACHE_SERVER | SSL_SESS_CACHE_NO_AUTO_CLEAR);
+//        long        input_session_cache_size = 20480;
+//        long        input_session_cache_timeout = 300;
+//        int         input_handshake_timeout = 30;
+
+        std::string  ssl_passwd           = "test";
+        std::string  ssl_passwd_dir       = "./sslfiles/";
+        std::string  ssl_passwd_file      = "ssl_password_file10.cf";
+        std::string  ssl_passwd_full_path = ssl_passwd_dir + ssl_passwd_file;
+
+        std::ofstream ofs( ssl_passwd_full_path.c_str() );
+
+        ofs << "[ssl]\n";
+        ofs << "ca_file=\""                 << input_ca_file << "\"\n";
+        ofs << "cert_chain_file=\""         << input_cert_chain_file << "\"\n";
+        ofs << "private_key_file=\""        << input_private_key_file << "\"\n";
+        ofs << "private_key_passwd_file=\"" << input_private_key_passwd_file << "\"\n";
+        ofs << "tmp_dh_file=\""             << input_tmp_dh_file << "\"\n";
+
+        ofs.close();
+
+        vs->set_ssl_file_name(ssl_passwd_full_path);
+
+        // unit_test[125] get_ssl_parameter check(private_key_file empty)
+        bool return_ssl_config = vs->get_ssl_parameter();
+
+        BOOST_CHECK_EQUAL( return_ssl_config, false );
+
+        unlink( ssl_passwd_full_path.c_str() );
+
+    }
+
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "get_ssl_parameter err (other filetype_str)" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    // get_ssl_parameter err (other filetype_str)
+    {
+        // read parameter clear
+        virtualservice_tcp_get_ssl_parameter_clear(vs);
+
+//        std::string input_ca_dir = "/home/komata/KomataCA/";
+        std::string input_ca_file = "CAfile.pem";
+//        std::string input_cert_chain_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_cert_chain_file = "cert.pem";
+//        std::string input_private_key_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_file = "server.key";
+        std::string input_private_key_filetype = "SSL_FILETYPE_HOGE";
+//        std::string input_private_key_passwd_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_passwd_file = "passwd.txt";
+//        int         input_verify_options = (SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT);
+//        int         input_verify_cert_depth = 4;
+//        long int    input_ssl_options = (SSL_OP_ALL | SSL_OP_NO_SSLv2 | SSL_OP_SINGLE_DH_USE);
+//        bool        input_is_tmp_dh_use = true;  // SSL_OP_SINGLE_DH_USE or defalut root is true
+//        std::string input_tmp_dh_dir = "/home/komata/KomataCA/";
+        std::string input_tmp_dh_file = "dh512.pem";
+//        std::string input_cipher_list = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH";
+//        bool        input_is_session_cache_use = true; // "on" deffault root is true
+//        long        input_session_cache_mode = (SSL_SESS_CACHE_SERVER | SSL_SESS_CACHE_NO_AUTO_CLEAR);
+//        long        input_session_cache_size = 20480;
+//        long        input_session_cache_timeout = 300;
+//        int         input_handshake_timeout = 30;
+
+        std::string  ssl_passwd           = "test";
+        std::string  ssl_passwd_dir       = "./sslfiles/";
+        std::string  ssl_passwd_file      = "ssl_password_file11.cf";
+        std::string  ssl_passwd_full_path = ssl_passwd_dir + ssl_passwd_file;
+
+        std::ofstream ofs( ssl_passwd_full_path.c_str() );
+
+        ofs << "[ssl]\n";
+        ofs << "ca_file=\""                 << input_ca_file << "\"\n";
+        ofs << "cert_chain_file=\""         << input_cert_chain_file << "\"\n";
+        ofs << "private_key_file=\""        << input_private_key_file << "\"\n";
+        ofs << "private_key_filetype=\""        << input_private_key_filetype << "\"\n";
+        ofs << "private_key_passwd_file=\"" << input_private_key_passwd_file << "\"\n";
+        ofs << "tmp_dh_file=\""             << input_tmp_dh_file << "\"\n";
+
+        ofs.close();
+
+        vs->set_ssl_file_name(ssl_passwd_full_path);
+
+        // unit_test[126] get_ssl_parameter check(other filetype_str)
+        bool return_ssl_config = vs->get_ssl_parameter();
+
+        BOOST_CHECK_EQUAL( return_ssl_config, false );
+
+        unlink( ssl_passwd_full_path.c_str() );
+
+    }
+
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "get_ssl_parameter err (private_key_passwd_file err)" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    // get_ssl_parameter err (private_key_passwd_file err)
+    {
+        // read parameter clear
+        virtualservice_tcp_get_ssl_parameter_clear(vs);
+
+//        std::string input_ca_dir = "/home/komata/KomataCA/";
+        std::string input_ca_file = "CAfile.pem";
+//        std::string input_cert_chain_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_cert_chain_file = "cert.pem";
+//        std::string input_private_key_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_file = "server.key";
+//        std::string input_private_key_filetype = "SSL_FILETYPE_PEM";
+//        std::string input_private_key_passwd_dir = "/home/komata/KomataCA/SERVER/";
+//!        std::string input_private_key_passwd_file = "passwd.txt";
+//        int         input_verify_options = (SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT);
+//        int         input_verify_cert_depth = 4;
+//        long int    input_ssl_options = (SSL_OP_ALL | SSL_OP_NO_SSLv2 | SSL_OP_SINGLE_DH_USE);
+//        bool        input_is_tmp_dh_use = true;  // SSL_OP_SINGLE_DH_USE or defalut root is true
+//        std::string input_tmp_dh_dir = "/home/komata/KomataCA/";
+        std::string input_tmp_dh_file = "dh512.pem";
+//        std::string input_cipher_list = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH";
+//        bool        input_is_session_cache_use = true; // "on" deffault root is true
+//        long        input_session_cache_mode = (SSL_SESS_CACHE_SERVER | SSL_SESS_CACHE_NO_AUTO_CLEAR);
+//        long        input_session_cache_size = 20480;
+//        long        input_session_cache_timeout = 300;
+//        int         input_handshake_timeout = 30;
+
+        std::string  ssl_passwd           = "test";
+        std::string  ssl_passwd_dir       = "./sslfiles/";
+        std::string  ssl_passwd_file      = "ssl_password_file12.cf";
+        std::string  ssl_passwd_full_path = ssl_passwd_dir + ssl_passwd_file;
+
+        std::ofstream ofs( ssl_passwd_full_path.c_str() );
+
+        ofs << "[ssl]\n";
+        ofs << "ca_file=\""                 << input_ca_file << "\"\n";
+        ofs << "cert_chain_file=\""         << input_cert_chain_file << "\"\n";
+        ofs << "private_key_file=\""        << input_private_key_file << "\"\n";
+//!        ofs << "private_key_passwd_file=\"" << input_private_key_passwd_file << "\"\n";
+        ofs << "tmp_dh_file=\""             << input_tmp_dh_file << "\"\n";
+
+        ofs.close();
+
+        vs->set_ssl_file_name(ssl_passwd_full_path);
+
+        // unit_test[127] get_ssl_parameter check(private_key_passwd_file err)
+        bool return_ssl_config = vs->get_ssl_parameter();
+
+        BOOST_CHECK_EQUAL( return_ssl_config, false );
+
+        unlink( ssl_passwd_full_path.c_str() );
+
+    }
+
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "get_ssl_parameter err (private_key_passwd_file empty)" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    // get_ssl_parameter err (private_key_passwd_file empty)
+    {
+        // read parameter clear
+        virtualservice_tcp_get_ssl_parameter_clear(vs);
+
+//        std::string input_ca_dir = "/home/komata/KomataCA/";
+        std::string input_ca_file = "CAfile.pem";
+//        std::string input_cert_chain_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_cert_chain_file = "cert.pem";
+//        std::string input_private_key_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_file = "server.key";
+//        std::string input_private_key_filetype = "SSL_FILETYPE_PEM";
+//        std::string input_private_key_passwd_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_passwd_file = "";
+//        int         input_verify_options = (SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT);
+//        int         input_verify_cert_depth = 4;
+//        long int    input_ssl_options = (SSL_OP_ALL | SSL_OP_NO_SSLv2 | SSL_OP_SINGLE_DH_USE);
+//        bool        input_is_tmp_dh_use = true;  // SSL_OP_SINGLE_DH_USE or defalut root is true
+//        std::string input_tmp_dh_dir = "/home/komata/KomataCA/";
+        std::string input_tmp_dh_file = "dh512.pem";
+//        std::string input_cipher_list = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH";
+//        bool        input_is_session_cache_use = true; // "on" deffault root is true
+//        long        input_session_cache_mode = (SSL_SESS_CACHE_SERVER | SSL_SESS_CACHE_NO_AUTO_CLEAR);
+//        long        input_session_cache_size = 20480;
+//        long        input_session_cache_timeout = 300;
+//        int         input_handshake_timeout = 30;
+
+        std::string  ssl_passwd           = "test";
+        std::string  ssl_passwd_dir       = "./sslfiles/";
+        std::string  ssl_passwd_file      = "ssl_password_file13.cf";
+        std::string  ssl_passwd_full_path = ssl_passwd_dir + ssl_passwd_file;
+
+        std::ofstream ofs( ssl_passwd_full_path.c_str() );
+
+        ofs << "[ssl]\n";
+        ofs << "ca_file=\""                 << input_ca_file << "\"\n";
+        ofs << "cert_chain_file=\""         << input_cert_chain_file << "\"\n";
+        ofs << "private_key_file=\""        << input_private_key_file << "\"\n";
+        ofs << "private_key_passwd_file=\"" << input_private_key_passwd_file << "\"\n";
+        ofs << "tmp_dh_file=\""             << input_tmp_dh_file << "\"\n";
+
+        ofs.close();
+
+        vs->set_ssl_file_name(ssl_passwd_full_path);
+
+        // unit_test[128] get_ssl_parameter check(private_key_passwd_file empty)
+        bool return_ssl_config = vs->get_ssl_parameter();
+
+        BOOST_CHECK_EQUAL( return_ssl_config, false );
+
+        unlink( ssl_passwd_full_path.c_str() );
+
+    }
+
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "get_ssl_parameter err (other verify_option)" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    // get_ssl_parameter err (other verify_option)
+    {
+        // read parameter clear
+        virtualservice_tcp_get_ssl_parameter_clear(vs);
+
+//        std::string input_ca_dir = "/home/komata/KomataCA/";
+        std::string input_ca_file = "CAfile.pem";
+//        std::string input_cert_chain_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_cert_chain_file = "cert.pem";
+//        std::string input_private_key_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_file = "server.key";
+//        std::string input_private_key_filetype = "SSL_FILETYPE_PEM";
+//        std::string input_private_key_passwd_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_passwd_file = "passwd.txt";
+//        int         input_verify_options = (SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT);
+//        int         input_verify_cert_depth = 4;
+//        long int    input_ssl_options = (SSL_OP_ALL | SSL_OP_NO_SSLv2 | SSL_OP_SINGLE_DH_USE);
+//        bool        input_is_tmp_dh_use = true;  // SSL_OP_SINGLE_DH_USE or defalut root is true
+//        std::string input_tmp_dh_dir = "/home/komata/KomataCA/";
+        std::string input_tmp_dh_file = "dh512.pem";
+//        std::string input_cipher_list = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH";
+//        bool        input_is_session_cache_use = true; // "on" deffault root is true
+//        long        input_session_cache_mode = (SSL_SESS_CACHE_SERVER | SSL_SESS_CACHE_NO_AUTO_CLEAR);
+//        long        input_session_cache_size = 20480;
+//        long        input_session_cache_timeout = 300;
+//        int         input_handshake_timeout = 30;
+
+        std::string  ssl_passwd           = "test";
+        std::string  ssl_passwd_dir       = "./sslfiles/";
+        std::string  ssl_passwd_file      = "ssl_password_file14.cf";
+        std::string  ssl_passwd_full_path = ssl_passwd_dir + ssl_passwd_file;
+
+        std::ofstream ofs( ssl_passwd_full_path.c_str() );
+
+        ofs << "[ssl]\n";
+        ofs << "ca_file=\""                 << input_ca_file << "\"\n";
+        ofs << "cert_chain_file=\""         << input_cert_chain_file << "\"\n";
+        ofs << "private_key_file=\""        << input_private_key_file << "\"\n";
+        ofs << "private_key_passwd_file=\"" << input_private_key_passwd_file << "\"\n";
+        ofs << "verify_options=\""          << "SSL_VERIFY_HOGE" << "\"\n";
+        ofs << "tmp_dh_file=\""             << input_tmp_dh_file << "\"\n";
+
+        ofs.close();
+
+        vs->set_ssl_file_name(ssl_passwd_full_path);
+
+        // unit_test[129] get_ssl_parameter check(other verify_option)
+        bool return_ssl_config = vs->get_ssl_parameter();
+
+        BOOST_CHECK_EQUAL( return_ssl_config, false );
+
+        unlink( ssl_passwd_full_path.c_str() );
+
+    }
+
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "get_ssl_parameter err (verify_cert_depth MIN)" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    // get_ssl_parameter err (verify_cert_depth MIN)
+    {
+        // read parameter clear
+        virtualservice_tcp_get_ssl_parameter_clear(vs);
+
+//        std::string input_ca_dir = "/home/komata/KomataCA/";
+        std::string input_ca_file = "CAfile.pem";
+//        std::string input_cert_chain_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_cert_chain_file = "cert.pem";
+//        std::string input_private_key_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_file = "server.key";
+//        std::string input_private_key_filetype = "SSL_FILETYPE_PEM";
+//        std::string input_private_key_passwd_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_passwd_file = "passwd.txt";
+//        int         input_verify_options = (SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT);
+        int         input_verify_cert_depth = -1;
+//        long int    input_ssl_options = (SSL_OP_ALL | SSL_OP_NO_SSLv2 | SSL_OP_SINGLE_DH_USE);
+//        bool        input_is_tmp_dh_use = true;  // SSL_OP_SINGLE_DH_USE or defalut root is true
+//        std::string input_tmp_dh_dir = "/home/komata/KomataCA/";
+        std::string input_tmp_dh_file = "dh512.pem";
+//        std::string input_cipher_list = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH";
+//        bool        input_is_session_cache_use = true; // "on" deffault root is true
+//        long        input_session_cache_mode = (SSL_SESS_CACHE_SERVER | SSL_SESS_CACHE_NO_AUTO_CLEAR);
+//        long        input_session_cache_size = 20480;
+//        long        input_session_cache_timeout = 300;
+//        int         input_handshake_timeout = 30;
+
+        std::string  ssl_passwd           = "test";
+        std::string  ssl_passwd_dir       = "./sslfiles/";
+        std::string  ssl_passwd_file      = "ssl_password_file15.cf";
+        std::string  ssl_passwd_full_path = ssl_passwd_dir + ssl_passwd_file;
+
+        std::ofstream ofs( ssl_passwd_full_path.c_str() );
+
+        ofs << "[ssl]\n";
+        ofs << "ca_file=\""                 << input_ca_file << "\"\n";
+        ofs << "cert_chain_file=\""         << input_cert_chain_file << "\"\n";
+        ofs << "private_key_file=\""        << input_private_key_file << "\"\n";
+        ofs << "private_key_passwd_file=\"" << input_private_key_passwd_file << "\"\n";
+        ofs << "verify_cert_depth="         << input_verify_cert_depth << "\n";
+        ofs << "tmp_dh_file=\""             << input_tmp_dh_file << "\"\n";
+
+        ofs.close();
+
+        vs->set_ssl_file_name(ssl_passwd_full_path);
+
+        // unit_test[130] get_ssl_parameter check(verify_cert_depth MIN)
+        bool return_ssl_config = vs->get_ssl_parameter();
+
+        BOOST_CHECK_EQUAL( return_ssl_config, false );
+
+        unlink( ssl_passwd_full_path.c_str() );
+
+    }
+
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "get_ssl_parameter err (verify_cert_depth MAX)" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    // get_ssl_parameter err (verify_cert_depth MAX)
+    {
+        // read parameter clear
+        virtualservice_tcp_get_ssl_parameter_clear(vs);
+
+//        std::string input_ca_dir = "/home/komata/KomataCA/";
+        std::string input_ca_file = "CAfile.pem";
+//        std::string input_cert_chain_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_cert_chain_file = "cert.pem";
+//        std::string input_private_key_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_file = "server.key";
+//        std::string input_private_key_filetype = "SSL_FILETYPE_PEM";
+//        std::string input_private_key_passwd_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_passwd_file = "passwd.txt";
+//        int         input_verify_options = (SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT);
+        int         input_verify_cert_depth = INT_MAX;
+//        long int    input_ssl_options = (SSL_OP_ALL | SSL_OP_NO_SSLv2 | SSL_OP_SINGLE_DH_USE);
+//        bool        input_is_tmp_dh_use = true;  // SSL_OP_SINGLE_DH_USE or defalut root is true
+//        std::string input_tmp_dh_dir = "/home/komata/KomataCA/";
+        std::string input_tmp_dh_file = "dh512.pem";
+//        std::string input_cipher_list = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH";
+//        bool        input_is_session_cache_use = true; // "on" deffault root is true
+//        long        input_session_cache_mode = (SSL_SESS_CACHE_SERVER | SSL_SESS_CACHE_NO_AUTO_CLEAR);
+//        long        input_session_cache_size = 20480;
+//        long        input_session_cache_timeout = 300;
+//        int         input_handshake_timeout = 30;
+
+        std::string  ssl_passwd           = "test";
+        std::string  ssl_passwd_dir       = "./sslfiles/";
+        std::string  ssl_passwd_file      = "ssl_password_file16.cf";
+        std::string  ssl_passwd_full_path = ssl_passwd_dir + ssl_passwd_file;
+
+        std::ofstream ofs( ssl_passwd_full_path.c_str() );
+
+        ofs << "[ssl]\n";
+        ofs << "ca_file=\""                 << input_ca_file << "\"\n";
+        ofs << "cert_chain_file=\""         << input_cert_chain_file << "\"\n";
+        ofs << "private_key_file=\""        << input_private_key_file << "\"\n";
+        ofs << "private_key_passwd_file=\"" << input_private_key_passwd_file << "\"\n";
+        ofs << "verify_cert_depth="         << input_verify_cert_depth << "0000000\n";
+        ofs << "tmp_dh_file=\""             << input_tmp_dh_file << "\"\n";
+
+        ofs.close();
+
+        vs->set_ssl_file_name(ssl_passwd_full_path);
+
+        // MAX over case confirmation on a desk
+        // MAX case
+        // unit_test[131] get_ssl_parameter check(verify_cert_depth MAX)
+        bool return_ssl_config = vs->get_ssl_parameter();
+
+        BOOST_CHECK_EQUAL( return_ssl_config, true );
+        BOOST_CHECK_EQUAL( vs->get_verify_cert_depth() , DEFAULT_SSL_VERIFY_CERT_DEPTH );
+
+        unlink( ssl_passwd_full_path.c_str() );
+
+    }
+
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "get_ssl_parameter err (tmp_dh_file err)" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    // get_ssl_parameter err (tmp_dh_file err)
+    {
+        // read parameter clear
+        virtualservice_tcp_get_ssl_parameter_clear(vs);
+
+//        std::string input_ca_dir = "/home/komata/KomataCA/";
+        std::string input_ca_file = "CAfile.pem";
+//        std::string input_cert_chain_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_cert_chain_file = "cert.pem";
+//        std::string input_private_key_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_file = "server.key";
+//        std::string input_private_key_filetype = "SSL_FILETYPE_PEM";
+//        std::string input_private_key_passwd_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_passwd_file = "passwd.txt";
+//        int         input_verify_options = (SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT);
+//        int         input_verify_cert_depth = 4;
+//        long int    input_ssl_options = (SSL_OP_ALL | SSL_OP_NO_SSLv2 | SSL_OP_SINGLE_DH_USE);
+//        bool        input_is_tmp_dh_use = true;  // SSL_OP_SINGLE_DH_USE or defalut root is true
+//        std::string input_tmp_dh_dir = "/home/komata/KomataCA/";
+//!        std::string input_tmp_dh_file = "dh512.pem";
+//        std::string input_cipher_list = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH";
+//        bool        input_is_session_cache_use = true; // "on" deffault root is true
+//        long        input_session_cache_mode = (SSL_SESS_CACHE_SERVER | SSL_SESS_CACHE_NO_AUTO_CLEAR);
+//        long        input_session_cache_size = 20480;
+//        long        input_session_cache_timeout = 300;
+//        int         input_handshake_timeout = 30;
+
+        std::string  ssl_passwd           = "test";
+        std::string  ssl_passwd_dir       = "./sslfiles/";
+        std::string  ssl_passwd_file      = "ssl_password_file17.cf";
+        std::string  ssl_passwd_full_path = ssl_passwd_dir + ssl_passwd_file;
+
+        std::ofstream ofs( ssl_passwd_full_path.c_str() );
+
+        ofs << "[ssl]\n";
+        ofs << "ca_file=\""                 << input_ca_file << "\"\n";
+        ofs << "cert_chain_file=\""         << input_cert_chain_file << "\"\n";
+        ofs << "private_key_file=\""        << input_private_key_file << "\"\n";
+        ofs << "private_key_passwd_file=\"" << input_private_key_passwd_file << "\"\n";
+//!        ofs << "tmp_dh_file=\""             << input_tmp_dh_file << "\"\n";
+
+        ofs.close();
+
+        vs->set_ssl_file_name(ssl_passwd_full_path);
+
+        // unit_test[132] get_ssl_parameter check(tmp_dh_file err)
+        bool return_ssl_config = vs->get_ssl_parameter();
+
+        BOOST_CHECK_EQUAL( return_ssl_config, false );
+
+        unlink( ssl_passwd_full_path.c_str() );
+
+    }
+
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "get_ssl_parameter err (tmp_dh_file empty)" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    // get_ssl_parameter err (tmp_dh_file empty)
+    {
+        // read parameter clear
+        virtualservice_tcp_get_ssl_parameter_clear(vs);
+
+//        std::string input_ca_dir = "/home/komata/KomataCA/";
+        std::string input_ca_file = "CAfile.pem";
+//        std::string input_cert_chain_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_cert_chain_file = "cert.pem";
+//        std::string input_private_key_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_file = "server.key";
+//        std::string input_private_key_filetype = "SSL_FILETYPE_PEM";
+//        std::string input_private_key_passwd_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_passwd_file = "passwd.txt";
+//        int         input_verify_options = (SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT);
+//        int         input_verify_cert_depth = 4;
+//        long int    input_ssl_options = (SSL_OP_ALL | SSL_OP_NO_SSLv2 | SSL_OP_SINGLE_DH_USE);
+//        bool        input_is_tmp_dh_use = true;  // SSL_OP_SINGLE_DH_USE or defalut root is true
+//        std::string input_tmp_dh_dir = "/home/komata/KomataCA/";
+        std::string input_tmp_dh_file = "";
+//        std::string input_cipher_list = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH";
+//        bool        input_is_session_cache_use = true; // "on" deffault root is true
+//        long        input_session_cache_mode = (SSL_SESS_CACHE_SERVER | SSL_SESS_CACHE_NO_AUTO_CLEAR);
+//        long        input_session_cache_size = 20480;
+//        long        input_session_cache_timeout = 300;
+//        int         input_handshake_timeout = 30;
+
+        std::string  ssl_passwd           = "test";
+        std::string  ssl_passwd_dir       = "./sslfiles/";
+        std::string  ssl_passwd_file      = "ssl_password_file18.cf";
+        std::string  ssl_passwd_full_path = ssl_passwd_dir + ssl_passwd_file;
+
+        std::ofstream ofs( ssl_passwd_full_path.c_str() );
+
+        ofs << "[ssl]\n";
+        ofs << "ca_file=\""                 << input_ca_file << "\"\n";
+        ofs << "cert_chain_file=\""         << input_cert_chain_file << "\"\n";
+        ofs << "private_key_file=\""        << input_private_key_file << "\"\n";
+        ofs << "private_key_passwd_file=\"" << input_private_key_passwd_file << "\"\n";
+        ofs << "tmp_dh_file=\""             << input_tmp_dh_file << "\"\n";
+
+        ofs.close();
+
+        vs->set_ssl_file_name(ssl_passwd_full_path);
+
+        // unit_test[133] get_ssl_parameter check(tmp_dh_file empty)
+        bool return_ssl_config = vs->get_ssl_parameter();
+
+        BOOST_CHECK_EQUAL( return_ssl_config, false );
+
+        unlink( ssl_passwd_full_path.c_str() );
+
+    }
+
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "get_ssl_parameter err (other cache_str)" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    // get_ssl_parameter err (other cache_str)
+    {
+        // read parameter clear
+        virtualservice_tcp_get_ssl_parameter_clear(vs);
+
+//        std::string input_ca_dir = "/home/komata/KomataCA/";
+        std::string input_ca_file = "CAfile.pem";
+//        std::string input_cert_chain_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_cert_chain_file = "cert.pem";
+//        std::string input_private_key_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_file = "server.key";
+//        std::string input_private_key_filetype = "SSL_FILETYPE_PEM";
+//        std::string input_private_key_passwd_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_passwd_file = "passwd.txt";
+//        int         input_verify_options = (SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT);
+//        int         input_verify_cert_depth = 4;
+//        long int    input_ssl_options = (SSL_OP_ALL | SSL_OP_NO_SSLv2 | SSL_OP_SINGLE_DH_USE);
+//        bool        input_is_tmp_dh_use = true;  // SSL_OP_SINGLE_DH_USE or defalut root is true
+//        std::string input_tmp_dh_dir = "/home/komata/KomataCA/";
+        std::string input_tmp_dh_file = "dh512.pem";
+//        std::string input_cipher_list = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH";
+//        bool        input_is_session_cache_use = true; // "on" deffault root is true
+//        long        input_session_cache_mode = (SSL_SESS_CACHE_SERVER | SSL_SESS_CACHE_NO_AUTO_CLEAR);
+//        long        input_session_cache_size = 20480;
+//        long        input_session_cache_timeout = 300;
+//        int         input_handshake_timeout = 30;
+
+        std::string  ssl_passwd           = "test";
+        std::string  ssl_passwd_dir       = "./sslfiles/";
+        std::string  ssl_passwd_file      = "ssl_password_file19.cf";
+        std::string  ssl_passwd_full_path = ssl_passwd_dir + ssl_passwd_file;
+
+        std::ofstream ofs( ssl_passwd_full_path.c_str() );
+
+        ofs << "[ssl]\n";
+        ofs << "ca_file=\""                 << input_ca_file << "\"\n";
+        ofs << "cert_chain_file=\""         << input_cert_chain_file << "\"\n";
+        ofs << "private_key_file=\""        << input_private_key_file << "\"\n";
+        ofs << "private_key_passwd_file=\"" << input_private_key_passwd_file << "\"\n";
+        ofs << "tmp_dh_file=\""             << input_tmp_dh_file << "\"\n";
+        ofs << "session_cache=\""           << "hoge" << "\"\n";
+
+        ofs.close();
+
+        vs->set_ssl_file_name(ssl_passwd_full_path);
+
+        // unit_test[134] get_ssl_parameter check(other cache_str)
+        bool return_ssl_config = vs->get_ssl_parameter();
+
+        BOOST_CHECK_EQUAL( return_ssl_config, false );
+
+        unlink( ssl_passwd_full_path.c_str() );
+
+    }
+
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "get_ssl_parameter err (session_cache_size MIN)" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    // get_ssl_parameter err (session_cache_size MIN)
+    {
+        // read parameter clear
+        virtualservice_tcp_get_ssl_parameter_clear(vs);
+
+//        std::string input_ca_dir = "/home/komata/KomataCA/";
+        std::string input_ca_file = "CAfile.pem";
+//        std::string input_cert_chain_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_cert_chain_file = "cert.pem";
+//        std::string input_private_key_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_file = "server.key";
+//        std::string input_private_key_filetype = "SSL_FILETYPE_PEM";
+//        std::string input_private_key_passwd_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_passwd_file = "passwd.txt";
+//        int         input_verify_options = (SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT);
+//        int         input_verify_cert_depth = 4;
+//        long int    input_ssl_options = (SSL_OP_ALL | SSL_OP_NO_SSLv2 | SSL_OP_SINGLE_DH_USE);
+//        bool        input_is_tmp_dh_use = true;  // SSL_OP_SINGLE_DH_USE or defalut root is true
+//        std::string input_tmp_dh_dir = "/home/komata/KomataCA/";
+        std::string input_tmp_dh_file = "dh512.pem";
+//        std::string input_cipher_list = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH";
+//        bool        input_is_session_cache_use = true; // "on" deffault root is true
+//        long        input_session_cache_mode = (SSL_SESS_CACHE_SERVER | SSL_SESS_CACHE_NO_AUTO_CLEAR);
+        long        input_session_cache_size = -1;
+//        long        input_session_cache_timeout = 300;
+//        int         input_handshake_timeout = 30;
+
+        std::string  ssl_passwd           = "test";
+        std::string  ssl_passwd_dir       = "./sslfiles/";
+        std::string  ssl_passwd_file      = "ssl_password_file20.cf";
+        std::string  ssl_passwd_full_path = ssl_passwd_dir + ssl_passwd_file;
+
+        std::ofstream ofs( ssl_passwd_full_path.c_str() );
+
+        ofs << "[ssl]\n";
+        ofs << "ca_file=\""                 << input_ca_file << "\"\n";
+        ofs << "cert_chain_file=\""         << input_cert_chain_file << "\"\n";
+        ofs << "private_key_file=\""        << input_private_key_file << "\"\n";
+        ofs << "private_key_passwd_file=\"" << input_private_key_passwd_file << "\"\n";
+        ofs << "tmp_dh_file=\""             << input_tmp_dh_file << "\"\n";
+        ofs << "session_cache_size="        << input_session_cache_size << "\n";
+
+        ofs.close();
+
+        vs->set_ssl_file_name(ssl_passwd_full_path);
+
+        // unit_test[135] get_ssl_parameter check(session_cache_size MIN)
+        bool return_ssl_config = vs->get_ssl_parameter();
+
+        BOOST_CHECK_EQUAL( return_ssl_config, false );
+
+        unlink( ssl_passwd_full_path.c_str() );
+
+    }
+
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "get_ssl_parameter err (session_cache_size MAX)" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    // get_ssl_parameter err (session_cache_size MAX)
+    {
+        // read parameter clear
+        virtualservice_tcp_get_ssl_parameter_clear(vs);
+
+//        std::string input_ca_dir = "/home/komata/KomataCA/";
+        std::string input_ca_file = "CAfile.pem";
+//        std::string input_cert_chain_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_cert_chain_file = "cert.pem";
+//        std::string input_private_key_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_file = "server.key";
+//        std::string input_private_key_filetype = "SSL_FILETYPE_PEM";
+//        std::string input_private_key_passwd_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_passwd_file = "passwd.txt";
+//        int         input_verify_options = (SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT);
+//        int         input_verify_cert_depth = 4;
+//        long int    input_ssl_options = (SSL_OP_ALL | SSL_OP_NO_SSLv2 | SSL_OP_SINGLE_DH_USE);
+//        bool        input_is_tmp_dh_use = true;  // SSL_OP_SINGLE_DH_USE or defalut root is true
+//        std::string input_tmp_dh_dir = "/home/komata/KomataCA/";
+        std::string input_tmp_dh_file = "dh512.pem";
+//        std::string input_cipher_list = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH";
+//        bool        input_is_session_cache_use = true; // "on" deffault root is true
+//        long        input_session_cache_mode = (SSL_SESS_CACHE_SERVER | SSL_SESS_CACHE_NO_AUTO_CLEAR);
+        long        input_session_cache_size = INT_MAX;
+//        long        input_session_cache_timeout = 300;
+//        int         input_handshake_timeout = 30;
+
+        std::string  ssl_passwd           = "test";
+        std::string  ssl_passwd_dir       = "./sslfiles/";
+        std::string  ssl_passwd_file      = "ssl_password_file21.cf";
+        std::string  ssl_passwd_full_path = ssl_passwd_dir + ssl_passwd_file;
+
+        std::ofstream ofs( ssl_passwd_full_path.c_str() );
+
+        ofs << "[ssl]\n";
+        ofs << "ca_file=\""                 << input_ca_file << "\"\n";
+        ofs << "cert_chain_file=\""         << input_cert_chain_file << "\"\n";
+        ofs << "private_key_file=\""        << input_private_key_file << "\"\n";
+        ofs << "private_key_passwd_file=\"" << input_private_key_passwd_file << "\"\n";
+        ofs << "tmp_dh_file=\""             << input_tmp_dh_file << "\"\n";
+        ofs << "session_cache_size="        << input_session_cache_size << "0000000\n";
+
+        ofs.close();
+
+        vs->set_ssl_file_name(ssl_passwd_full_path);
+
+        // MAX over case confirmation on a desk
+        // MAX case
+        // unit_test[136] get_ssl_parameter check(session_cache_size MAX)
+        bool return_ssl_config = vs->get_ssl_parameter();
+
+        BOOST_CHECK_EQUAL( return_ssl_config, true );
+        BOOST_CHECK_EQUAL( vs->get_session_cache_size() , DEFAULT_SSL_SESSION_CACHE_SIZE );
+
+        unlink( ssl_passwd_full_path.c_str() );
+
+    }
+
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "get_ssl_parameter err (session_cache_timeout MIN)" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    // get_ssl_parameter err (session_cache_timeout MIN)
+    {
+        // read parameter clear
+        virtualservice_tcp_get_ssl_parameter_clear(vs);
+
+//        std::string input_ca_dir = "/home/komata/KomataCA/";
+        std::string input_ca_file = "CAfile.pem";
+//        std::string input_cert_chain_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_cert_chain_file = "cert.pem";
+//        std::string input_private_key_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_file = "server.key";
+//        std::string input_private_key_filetype = "SSL_FILETYPE_PEM";
+//        std::string input_private_key_passwd_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_passwd_file = "passwd.txt";
+//        int         input_verify_options = (SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT);
+//        int         input_verify_cert_depth = 4;
+//        long int    input_ssl_options = (SSL_OP_ALL | SSL_OP_NO_SSLv2 | SSL_OP_SINGLE_DH_USE);
+//        bool        input_is_tmp_dh_use = true;  // SSL_OP_SINGLE_DH_USE or defalut root is true
+//        std::string input_tmp_dh_dir = "/home/komata/KomataCA/";
+        std::string input_tmp_dh_file = "dh512.pem";
+//        std::string input_cipher_list = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH";
+//        bool        input_is_session_cache_use = true; // "on" deffault root is true
+//        long        input_session_cache_mode = (SSL_SESS_CACHE_SERVER | SSL_SESS_CACHE_NO_AUTO_CLEAR);
+//        long        input_session_cache_size = 20480;
+        long        input_session_cache_timeout = -1;
+//        int         input_handshake_timeout = 30;
+
+        std::string  ssl_passwd           = "test";
+        std::string  ssl_passwd_dir       = "./sslfiles/";
+        std::string  ssl_passwd_file      = "ssl_password_file22.cf";
+        std::string  ssl_passwd_full_path = ssl_passwd_dir + ssl_passwd_file;
+
+        std::ofstream ofs( ssl_passwd_full_path.c_str() );
+
+        ofs << "[ssl]\n";
+        ofs << "ca_file=\""                 << input_ca_file << "\"\n";
+        ofs << "cert_chain_file=\""         << input_cert_chain_file << "\"\n";
+        ofs << "private_key_file=\""        << input_private_key_file << "\"\n";
+        ofs << "private_key_passwd_file=\"" << input_private_key_passwd_file << "\"\n";
+        ofs << "tmp_dh_file=\""             << input_tmp_dh_file << "\"\n";
+        ofs << "session_cache_timeout="     << input_session_cache_timeout << "\n";
+
+        ofs.close();
+
+        vs->set_ssl_file_name(ssl_passwd_full_path);
+
+        // unit_test[137] get_ssl_parameter check(session_cache_timeout MIN)
+        bool return_ssl_config = vs->get_ssl_parameter();
+
+        BOOST_CHECK_EQUAL( return_ssl_config, false );
+
+        unlink( ssl_passwd_full_path.c_str() );
+
+    }
+
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "get_ssl_parameter err (session_cache_timeout MAX)" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    // get_ssl_parameter err (session_cache_timeout MAX)
+    {
+        // read parameter clear
+        virtualservice_tcp_get_ssl_parameter_clear(vs);
+
+//        std::string input_ca_dir = "/home/komata/KomataCA/";
+        std::string input_ca_file = "CAfile.pem";
+//        std::string input_cert_chain_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_cert_chain_file = "cert.pem";
+//        std::string input_private_key_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_file = "server.key";
+//        std::string input_private_key_filetype = "SSL_FILETYPE_PEM";
+//        std::string input_private_key_passwd_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_passwd_file = "passwd.txt";
+//        int         input_verify_options = (SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT);
+//        int         input_verify_cert_depth = 4;
+//        long int    input_ssl_options = (SSL_OP_ALL | SSL_OP_NO_SSLv2 | SSL_OP_SINGLE_DH_USE);
+//        bool        input_is_tmp_dh_use = true;  // SSL_OP_SINGLE_DH_USE or defalut root is true
+//        std::string input_tmp_dh_dir = "/home/komata/KomataCA/";
+        std::string input_tmp_dh_file = "dh512.pem";
+//        std::string input_cipher_list = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH";
+//        bool        input_is_session_cache_use = true; // "on" deffault root is true
+//        long        input_session_cache_mode = (SSL_SESS_CACHE_SERVER | SSL_SESS_CACHE_NO_AUTO_CLEAR);
+//        long        input_session_cache_size = 20480;
+        long        input_session_cache_timeout = INT_MAX;
+//        int         input_handshake_timeout = 30;
+
+        std::string  ssl_passwd           = "test";
+        std::string  ssl_passwd_dir       = "./sslfiles/";
+        std::string  ssl_passwd_file      = "ssl_password_file23.cf";
+        std::string  ssl_passwd_full_path = ssl_passwd_dir + ssl_passwd_file;
+
+        std::ofstream ofs( ssl_passwd_full_path.c_str() );
+
+        ofs << "[ssl]\n";
+        ofs << "ca_file=\""                 << input_ca_file << "\"\n";
+        ofs << "cert_chain_file=\""         << input_cert_chain_file << "\"\n";
+        ofs << "private_key_file=\""        << input_private_key_file << "\"\n";
+        ofs << "private_key_passwd_file=\"" << input_private_key_passwd_file << "\"\n";
+        ofs << "tmp_dh_file=\""             << input_tmp_dh_file << "\"\n";
+        ofs << "session_cache_timeout="     << input_session_cache_timeout << "00000\n";
+
+        ofs.close();
+
+        vs->set_ssl_file_name(ssl_passwd_full_path);
+
+        // MAX over case confirmation on a desk
+        // MAX case
+        // unit_test[138] get_ssl_parameter check(session_cache_timeout MAX)
+        bool return_ssl_config = vs->get_ssl_parameter();
+
+        BOOST_CHECK_EQUAL( return_ssl_config, true );
+        BOOST_CHECK_EQUAL( vs->get_session_cache_timeout() , DEFAULT_SSL_SESSION_CACHE_TIMEOUT );
+
+        unlink( ssl_passwd_full_path.c_str() );
+
+    }
+
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "get_ssl_parameter err (handshake_timeout MIN)" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    // get_ssl_parameter err (handshake_timeout MIN)
+    {
+        // read parameter clear
+        virtualservice_tcp_get_ssl_parameter_clear(vs);
+
+//        std::string input_ca_dir = "/home/komata/KomataCA/";
+        std::string input_ca_file = "CAfile.pem";
+//        std::string input_cert_chain_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_cert_chain_file = "cert.pem";
+//        std::string input_private_key_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_file = "server.key";
+//        std::string input_private_key_filetype = "SSL_FILETYPE_PEM";
+//        std::string input_private_key_passwd_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_passwd_file = "passwd.txt";
+//        int         input_verify_options = (SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT);
+//        int         input_verify_cert_depth = 4;
+//        long int    input_ssl_options = (SSL_OP_ALL | SSL_OP_NO_SSLv2 | SSL_OP_SINGLE_DH_USE);
+//        bool        input_is_tmp_dh_use = true;  // SSL_OP_SINGLE_DH_USE or defalut root is true
+//        std::string input_tmp_dh_dir = "/home/komata/KomataCA/";
+        std::string input_tmp_dh_file = "dh512.pem";
+//        std::string input_cipher_list = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH";
+//        bool        input_is_session_cache_use = true; // "on" deffault root is true
+//        long        input_session_cache_mode = (SSL_SESS_CACHE_SERVER | SSL_SESS_CACHE_NO_AUTO_CLEAR);
+//        long        input_session_cache_size = 20480;
+//        long        input_session_cache_timeout = 300;
+        int         input_handshake_timeout = -1;
+
+        std::string  ssl_passwd           = "test";
+        std::string  ssl_passwd_dir       = "./sslfiles/";
+        std::string  ssl_passwd_file      = "ssl_password_file24.cf";
+        std::string  ssl_passwd_full_path = ssl_passwd_dir + ssl_passwd_file;
+
+        std::ofstream ofs( ssl_passwd_full_path.c_str() );
+
+        ofs << "[ssl]\n";
+        ofs << "ca_file=\""                 << input_ca_file << "\"\n";
+        ofs << "cert_chain_file=\""         << input_cert_chain_file << "\"\n";
+        ofs << "private_key_file=\""        << input_private_key_file << "\"\n";
+        ofs << "private_key_passwd_file=\"" << input_private_key_passwd_file << "\"\n";
+        ofs << "tmp_dh_file=\""             << input_tmp_dh_file << "\"\n";
+        ofs << "timeout_sec="               << input_handshake_timeout << "\n";
+
+        ofs.close();
+
+        vs->set_ssl_file_name(ssl_passwd_full_path);
+
+        // unit_test[139] get_ssl_parameter check(handshake_timeout MIN)
+        bool return_ssl_config = vs->get_ssl_parameter();
+
+        BOOST_CHECK_EQUAL( return_ssl_config, false );
+
+        unlink( ssl_passwd_full_path.c_str() );
+
+    }
+
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "get_ssl_parameter err (handshake_timeout MAX)" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    // get_ssl_parameter err (handshake_timeout MAX)
+    {
+        // read parameter clear
+        virtualservice_tcp_get_ssl_parameter_clear(vs);
+
+//        std::string input_ca_dir = "/home/komata/KomataCA/";
+        std::string input_ca_file = "CAfile.pem";
+//        std::string input_cert_chain_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_cert_chain_file = "cert.pem";
+//        std::string input_private_key_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_file = "server.key";
+//        std::string input_private_key_filetype = "SSL_FILETYPE_PEM";
+//        std::string input_private_key_passwd_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_passwd_file = "passwd.txt";
+//        int         input_verify_options = (SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT);
+//        int         input_verify_cert_depth = 4;
+//        long int    input_ssl_options = (SSL_OP_ALL | SSL_OP_NO_SSLv2 | SSL_OP_SINGLE_DH_USE);
+//        bool        input_is_tmp_dh_use = true;  // SSL_OP_SINGLE_DH_USE or defalut root is true
+//        std::string input_tmp_dh_dir = "/home/komata/KomataCA/";
+        std::string input_tmp_dh_file = "dh512.pem";
+//        std::string input_cipher_list = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH";
+//        bool        input_is_session_cache_use = true; // "on" deffault root is true
+//        long        input_session_cache_mode = (SSL_SESS_CACHE_SERVER | SSL_SESS_CACHE_NO_AUTO_CLEAR);
+//        long        input_session_cache_size = 20480;
+//        long        input_session_cache_timeout = 300;
+        int         input_handshake_timeout = INT_MAX;
+
+        std::string  ssl_passwd           = "test";
+        std::string  ssl_passwd_dir       = "./sslfiles/";
+        std::string  ssl_passwd_file      = "ssl_password_file25.cf";
+        std::string  ssl_passwd_full_path = ssl_passwd_dir + ssl_passwd_file;
+
+        std::ofstream ofs( ssl_passwd_full_path.c_str() );
+
+        ofs << "[ssl]\n";
+        ofs << "ca_file=\""                 << input_ca_file << "\"\n";
+        ofs << "cert_chain_file=\""         << input_cert_chain_file << "\"\n";
+        ofs << "private_key_file=\""        << input_private_key_file << "\"\n";
+        ofs << "private_key_passwd_file=\"" << input_private_key_passwd_file << "\"\n";
+        ofs << "tmp_dh_file=\""             << input_tmp_dh_file << "\"\n";
+        ofs << "timeout_sec="               << input_handshake_timeout << "00000\n";
+
+        ofs.close();
+
+        vs->set_ssl_file_name(ssl_passwd_full_path);
+
+        // MAX over case confirmation on a desk
+        // MAX case
+        // unit_test[140] get_ssl_parameter check(handshake_timeout MAX)
+        bool return_ssl_config = vs->get_ssl_parameter();
+
+        BOOST_CHECK_EQUAL( return_ssl_config, true );
+        BOOST_CHECK_EQUAL( vs->get_handshake_timeout() , DEFAULT_SSL_HANDSHAKE_TIMEOUT );
+
+        unlink( ssl_passwd_full_path.c_str() );
+
+    }
+
+    BOOST_MESSAGE( "-------??" );
+    delete vs;
+
+}
+
+// set_ssl_config test
+void    virtualservice_tcp_set_ssl_config(){
+    counter = 1;
+
+    debugg_flug_struct::getInstance().pmcontrol_err_flag() = false;
+    debugg_flug_struct::getInstance().smcontrol_err_flag() = false;
+    debugg_flug_struct::getInstance().param_exist_flag()   = false;
+
+    l7vs::l7vsd                     vsd;
+    boost::asio::io_service         dispatcher;
+    l7vs::replication               rep;
+    l7vs::virtualservice_element    element;
+    //set element value
+    element.udpmode                 = false;
+    element.tcp_accept_endpoint     = tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    element.udp_recv_endpoint       = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    element.realserver_vector.clear();
+    element.protocol_module_name    = "PMtest1";
+    element.schedule_module_name    = "SMtest1";
+    element.protocol_args.clear();
+    element.protocol_args.push_back( "testarg" );
+    element.protocol_args.push_back( "testarg2" );
+    element.sorry_maxconnection     = 1234LL;
+    element.sorry_endpoint          = tcp_ep_type( boost::asio::ip::address::from_string( "10.144.169.87" ), (8080) );
+    element.sorry_flag              = false;
+    element.qos_upstream            = 65535ULL;
+    element.qos_downstream          = 32767ULL;
+
+    l7vs::vs_tcp*    vs = new l7vs::vs_tcp( vsd, rep, element );
+
+    BOOST_CHECK_EQUAL( &vsd, &(vs->get_vsd()) );
+    BOOST_CHECK_EQUAL( &rep, &(vs->get_rep()) );
+    BOOST_CHECK( element == vs->get_element() );
+
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "set_ssl_config normal case01" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    // set_ssl_config normal case01
+    {
+        std::string input_ca_file = "CAfile.pem";
+        std::string input_ca_dir = "/home/komata/KomataCA/";
+        std::string input_cert_chain_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_cert_chain_file = "cert.pem";
+        std::string input_private_key_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_file = "server.key";
+        boost::asio::ssl::context::file_format
+                    input_private_key_filetype = DEFAULT_SSL_PRIVATE_KEY_FILETYPE;
+        int         input_verify_options = SSL_VERIFY_PEER;
+
+        std::string input_private_key_passwd_dir  = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_passwd_file = "passwd.txt";
+
+        int         input_verify_cert_depth = 4;
+        long int    input_ssl_options = (SSL_OP_ALL|SSL_OP_NO_SSLv2|SSL_OP_SINGLE_DH_USE);
+        bool        input_is_tmp_dh_use = false;
+        std::string input_tmp_dh_dir = "/home/komata/KomataCA/";
+        std::string input_tmp_dh_file = "dh512.pem";
+        std::string input_cipher_list = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH";
+        bool        input_is_session_cache_use = true;
+        long        input_session_cache_mode = (SSL_SESS_CACHE_SERVER | SSL_SESS_CACHE_NO_AUTO_CLEAR);
+        long        input_session_cache_size = 20480;
+        long        input_session_cache_timeout = 300;
+
+        vs->set_ca_file(input_ca_file);
+        vs->set_ca_dir(input_ca_dir);
+        vs->set_cert_chain_dir(input_cert_chain_dir);
+        vs->set_cert_chain_file(input_cert_chain_file);
+        vs->set_private_key_dir(input_private_key_dir);
+        vs->set_private_key_file(input_private_key_file);
+        vs->set_private_key_filetype(input_private_key_filetype);
+        vs->set_private_key_passwd_dir(input_private_key_passwd_dir);
+        vs->set_private_key_passwd_file(input_private_key_passwd_file);
+        vs->set_verify_options(input_verify_options);
+        vs->set_verify_cert_depth(input_verify_cert_depth);
+        vs->set_ssl_options(input_ssl_options);
+        vs->set_is_tmp_dh_use(input_is_tmp_dh_use);
+        vs->set_tmp_dh_dir(input_tmp_dh_dir);
+        vs->set_tmp_dh_file(input_tmp_dh_file);
+        vs->set_cipher_list(input_cipher_list);
+        vs->set_is_session_cache_use(input_is_session_cache_use);
+        vs->set_session_cache_mode(input_session_cache_mode);
+        vs->set_session_cache_size(input_session_cache_size);
+        vs->set_session_cache_timeout(input_session_cache_timeout);
+
+        bool return_ssl_config = vs->set_ssl_config();
+    
+        //! set_ssl_config return data
+        // unit_test[141] set_ssl_config normal case01
+        BOOST_CHECK_EQUAL( return_ssl_config, true );
+
+    }
+
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "set_ssl_config normal case02 (no ca_file)" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    // set_ssl_config normal case02 (no ca_file)
+    {
+    
+        std::string input_ca_file = "";
+        std::string input_ca_dir = "/home/komata/KomataCA/";
+        std::string input_cert_chain_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_cert_chain_file = "cert.pem";
+        std::string input_private_key_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_file = "server.key";
+        boost::asio::ssl::context::file_format
+                    input_private_key_filetype = DEFAULT_SSL_PRIVATE_KEY_FILETYPE;
+        int         input_verify_options = SSL_VERIFY_PEER;
+
+        std::string input_private_key_passwd_dir  = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_passwd_file = "passwd.txt";
+
+        int         input_verify_cert_depth = 4;
+        long int    input_ssl_options = (SSL_OP_ALL|SSL_OP_NO_SSLv2);
+        bool        input_is_tmp_dh_use = false;
+        std::string input_tmp_dh_dir = "";
+        std::string input_tmp_dh_file = "";
+        std::string input_cipher_list = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH";
+        bool        input_is_session_cache_use = true;
+        long        input_session_cache_mode = (SSL_SESS_CACHE_SERVER | SSL_SESS_CACHE_NO_AUTO_CLEAR);
+        long        input_session_cache_size = 20480;
+        long        input_session_cache_timeout = 300;
+
+        vs->set_ca_file(input_ca_file);
+        vs->set_ca_dir(input_ca_dir);
+        vs->set_cert_chain_dir(input_cert_chain_dir);
+        vs->set_cert_chain_file(input_cert_chain_file);
+        vs->set_private_key_dir(input_private_key_dir);
+        vs->set_private_key_file(input_private_key_file);
+        vs->set_private_key_filetype(input_private_key_filetype);
+        vs->set_private_key_passwd_dir(input_private_key_passwd_dir);
+        vs->set_private_key_passwd_file(input_private_key_passwd_file);
+        vs->set_verify_options(input_verify_options);
+        vs->set_verify_cert_depth(input_verify_cert_depth);
+        vs->set_ssl_options(input_ssl_options);
+        vs->set_is_tmp_dh_use(input_is_tmp_dh_use);
+        vs->set_tmp_dh_dir(input_tmp_dh_dir);
+        vs->set_tmp_dh_file(input_tmp_dh_file);
+        vs->set_cipher_list(input_cipher_list);
+        vs->set_is_session_cache_use(input_is_session_cache_use);
+        vs->set_session_cache_mode(input_session_cache_mode);
+        vs->set_session_cache_size(input_session_cache_size);
+        vs->set_session_cache_timeout(input_session_cache_timeout);
+
+        bool return_ssl_config = vs->set_ssl_config();
+    
+        //! set_ssl_config return data
+        // unit_test[142] set_ssl_config normal case02 (no ca_file)
+        BOOST_CHECK_EQUAL( return_ssl_config, true );
+
+    }
+
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "set_ssl_config error (no ca_file,no_ca_dir)" << std::endl;
+    std::cout << "  target : Set root CA path error" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    // set_ssl_config error (no ca_file,no_ca_dir)
+    {
+    
+        std::string input_ca_file = "";
+        std::string input_ca_dir = "";
+        std::string input_cert_chain_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_cert_chain_file = "cert.pem";
+        std::string input_private_key_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_file = "server.key";
+        boost::asio::ssl::context::file_format
+                    input_private_key_filetype = DEFAULT_SSL_PRIVATE_KEY_FILETYPE;
+        int         input_verify_options = SSL_VERIFY_PEER;
+
+        std::string input_private_key_passwd_dir  = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_passwd_file = "passwd.txt";
+
+        int         input_verify_cert_depth = 4;
+        long int    input_ssl_options = (SSL_OP_ALL|SSL_OP_NO_SSLv2);
+        bool        input_is_tmp_dh_use = false;
+        std::string input_tmp_dh_dir = "";
+        std::string input_tmp_dh_file = "";
+        std::string input_cipher_list = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH";
+        bool        input_is_session_cache_use = true;
+        long        input_session_cache_mode = (SSL_SESS_CACHE_SERVER | SSL_SESS_CACHE_NO_AUTO_CLEAR);
+        long        input_session_cache_size = 20480;
+        long        input_session_cache_timeout = 300;
+
+        vs->set_ca_file(input_ca_file);
+        vs->set_ca_dir(input_ca_dir);
+        vs->set_cert_chain_dir(input_cert_chain_dir);
+        vs->set_cert_chain_file(input_cert_chain_file);
+        vs->set_private_key_dir(input_private_key_dir);
+        vs->set_private_key_file(input_private_key_file);
+        vs->set_private_key_filetype(input_private_key_filetype);
+        vs->set_private_key_passwd_dir(input_private_key_passwd_dir);
+        vs->set_private_key_passwd_file(input_private_key_passwd_file);
+        vs->set_verify_options(input_verify_options);
+        vs->set_verify_cert_depth(input_verify_cert_depth);
+        vs->set_ssl_options(input_ssl_options);
+        vs->set_is_tmp_dh_use(input_is_tmp_dh_use);
+        vs->set_tmp_dh_dir(input_tmp_dh_dir);
+        vs->set_tmp_dh_file(input_tmp_dh_file);
+        vs->set_cipher_list(input_cipher_list);
+        vs->set_is_session_cache_use(input_is_session_cache_use);
+        vs->set_session_cache_mode(input_session_cache_mode);
+        vs->set_session_cache_size(input_session_cache_size);
+        vs->set_session_cache_timeout(input_session_cache_timeout);
+
+        bool return_ssl_config = vs->set_ssl_config();
+
+        //! set_ssl_config return data
+        // unit_test[143] set_ssl_config error (no ca_file,no ca_dir)
+        BOOST_CHECK_EQUAL( return_ssl_config, false );
+        // LOG:Set root CA path error
+
+   }
+
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "set_ssl_config error (no ca_dir)" << std::endl;
+    std::cout << "  target : Set root CA file error" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    // set_ssl_config error (no_ca_dir)
+    {
+
+        std::string input_ca_file = "CAfile.pem";
+        std::string input_ca_dir = "";
+        std::string input_cert_chain_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_cert_chain_file = "cert.pem";
+        std::string input_private_key_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_file = "server.key";
+        boost::asio::ssl::context::file_format
+                    input_private_key_filetype = DEFAULT_SSL_PRIVATE_KEY_FILETYPE;
+        int         input_verify_options = SSL_VERIFY_PEER;
+
+        std::string input_private_key_passwd_dir  = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_passwd_file = "passwd.txt";
+
+        int         input_verify_cert_depth = 4;
+        long int    input_ssl_options = (SSL_OP_ALL|SSL_OP_NO_SSLv2);
+        bool        input_is_tmp_dh_use = false;
+        std::string input_tmp_dh_dir = "";
+        std::string input_tmp_dh_file = "";
+        std::string input_cipher_list = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH";
+        bool        input_is_session_cache_use = true;
+        long        input_session_cache_mode = (SSL_SESS_CACHE_SERVER | SSL_SESS_CACHE_NO_AUTO_CLEAR);
+        long        input_session_cache_size = 20480;
+        long        input_session_cache_timeout = 300;
+
+        vs->set_ca_file(input_ca_file);
+        vs->set_ca_dir(input_ca_dir);
+        vs->set_cert_chain_dir(input_cert_chain_dir);
+        vs->set_cert_chain_file(input_cert_chain_file);
+        vs->set_private_key_dir(input_private_key_dir);
+        vs->set_private_key_file(input_private_key_file);
+        vs->set_private_key_filetype(input_private_key_filetype);
+        vs->set_private_key_passwd_dir(input_private_key_passwd_dir);
+        vs->set_private_key_passwd_file(input_private_key_passwd_file);
+        vs->set_verify_options(input_verify_options);
+        vs->set_verify_cert_depth(input_verify_cert_depth);
+        vs->set_ssl_options(input_ssl_options);
+        vs->set_is_tmp_dh_use(input_is_tmp_dh_use);
+        vs->set_tmp_dh_dir(input_tmp_dh_dir);
+        vs->set_tmp_dh_file(input_tmp_dh_file);
+        vs->set_cipher_list(input_cipher_list);
+        vs->set_is_session_cache_use(input_is_session_cache_use);
+        vs->set_session_cache_mode(input_session_cache_mode);
+        vs->set_session_cache_size(input_session_cache_size);
+        vs->set_session_cache_timeout(input_session_cache_timeout);
+
+        bool return_ssl_config = vs->set_ssl_config();
+    
+        //! set_ssl_config return data
+        // unit_test[144] set_ssl_config error (no_ca_dir)
+        BOOST_CHECK_EQUAL( return_ssl_config, false );
+        // LOG:Set root CA file error
+
+   }
+
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "set_ssl_config error (chain file)" << std::endl;
+    std::cout << "  target : Set certificate chain file error" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    // set_ssl_config error (chain file)
+    {
+        std::string input_ca_file = "CAfile.pem";
+        std::string input_ca_dir = "/home/komata/KomataCA/";
+        std::string input_cert_chain_dir = "/home/komata/KomataCA/SERVER/";
+//        std::string input_cert_chain_file = "cert.pem";
+        std::string input_cert_chain_file = "hoge.pem";
+        std::string input_private_key_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_file = "server.key";
+        boost::asio::ssl::context::file_format
+                    input_private_key_filetype = DEFAULT_SSL_PRIVATE_KEY_FILETYPE;
+        int         input_verify_options = SSL_VERIFY_PEER;
+
+        std::string input_private_key_passwd_dir  = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_passwd_file = "passwd.txt";
+
+        int         input_verify_cert_depth = 4;
+        long int    input_ssl_options = (SSL_OP_ALL|SSL_OP_NO_SSLv2|SSL_OP_SINGLE_DH_USE);
+        bool        input_is_tmp_dh_use = false;
+        std::string input_tmp_dh_dir = "/home/komata/KomataCA/";
+        std::string input_tmp_dh_file = "dh512.pem";
+        std::string input_cipher_list = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH";
+        bool        input_is_session_cache_use = true;
+        long        input_session_cache_mode = (SSL_SESS_CACHE_SERVER | SSL_SESS_CACHE_NO_AUTO_CLEAR);
+        long        input_session_cache_size = 20480;
+        long        input_session_cache_timeout = 300;
+
+        vs->set_ca_file(input_ca_file);
+        vs->set_ca_dir(input_ca_dir);
+        vs->set_cert_chain_dir(input_cert_chain_dir);
+        vs->set_cert_chain_file(input_cert_chain_file);
+        vs->set_private_key_dir(input_private_key_dir);
+        vs->set_private_key_file(input_private_key_file);
+        vs->set_private_key_filetype(input_private_key_filetype);
+        vs->set_private_key_passwd_dir(input_private_key_passwd_dir);
+        vs->set_private_key_passwd_file(input_private_key_passwd_file);
+        vs->set_verify_options(input_verify_options);
+        vs->set_verify_cert_depth(input_verify_cert_depth);
+        vs->set_ssl_options(input_ssl_options);
+        vs->set_is_tmp_dh_use(input_is_tmp_dh_use);
+        vs->set_tmp_dh_dir(input_tmp_dh_dir);
+        vs->set_tmp_dh_file(input_tmp_dh_file);
+        vs->set_cipher_list(input_cipher_list);
+        vs->set_is_session_cache_use(input_is_session_cache_use);
+        vs->set_session_cache_mode(input_session_cache_mode);
+        vs->set_session_cache_size(input_session_cache_size);
+        vs->set_session_cache_timeout(input_session_cache_timeout);
+
+        bool return_ssl_config = vs->set_ssl_config();
+    
+        //! set_ssl_config return data
+        // unit_test[145] set_ssl_config error (chain file)
+        BOOST_CHECK_EQUAL( return_ssl_config, false );
+        // LOG:Set certificate chain file error
+
+    }
+
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "set_ssl_config error (set_password_callback)" << std::endl;
+    std::cout << "  target : Set password callback error" << std::endl;
+    std::cout << "  check on desk" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    // set_ssl_config error (set_password_callback)
+    {
+        std::string input_ca_file = "CAfile.pem";
+        std::string input_ca_dir = "/home/komata/KomataCA/";
+        std::string input_cert_chain_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_cert_chain_file = "cert.pem";
+        std::string input_private_key_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_file = "server.key";
+        boost::asio::ssl::context::file_format
+                    input_private_key_filetype = DEFAULT_SSL_PRIVATE_KEY_FILETYPE;
+        int         input_verify_options = SSL_VERIFY_PEER;
+
+        std::string input_private_key_passwd_dir  = "/home/komata/KomataCA/SERVER/";
+//        std::string input_private_key_passwd_file = "passwd.txt";
+        std::string input_private_key_passwd_file = "hoge.txt";
+
+        int         input_verify_cert_depth = 4;
+        long int    input_ssl_options = (SSL_OP_ALL|SSL_OP_NO_SSLv2|SSL_OP_SINGLE_DH_USE);
+        bool        input_is_tmp_dh_use = false;
+        std::string input_tmp_dh_dir = "/home/komata/KomataCA/";
+        std::string input_tmp_dh_file = "dh512.pem";
+        std::string input_cipher_list = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH";
+        bool        input_is_session_cache_use = true;
+        long        input_session_cache_mode = (SSL_SESS_CACHE_SERVER | SSL_SESS_CACHE_NO_AUTO_CLEAR);
+        long        input_session_cache_size = 20480;
+        long        input_session_cache_timeout = 300;
+
+        vs->set_ca_file(input_ca_file);
+        vs->set_ca_dir(input_ca_dir);
+        vs->set_cert_chain_dir(input_cert_chain_dir);
+        vs->set_cert_chain_file(input_cert_chain_file);
+        vs->set_private_key_dir(input_private_key_dir);
+        vs->set_private_key_file(input_private_key_file);
+        vs->set_private_key_filetype(input_private_key_filetype);
+        vs->set_private_key_passwd_dir(input_private_key_passwd_dir);
+        vs->set_private_key_passwd_file(input_private_key_passwd_file);
+        vs->set_verify_options(input_verify_options);
+        vs->set_verify_cert_depth(input_verify_cert_depth);
+        vs->set_ssl_options(input_ssl_options);
+        vs->set_is_tmp_dh_use(input_is_tmp_dh_use);
+        vs->set_tmp_dh_dir(input_tmp_dh_dir);
+        vs->set_tmp_dh_file(input_tmp_dh_file);
+        vs->set_cipher_list(input_cipher_list);
+        vs->set_is_session_cache_use(input_is_session_cache_use);
+        vs->set_session_cache_mode(input_session_cache_mode);
+        vs->set_session_cache_size(input_session_cache_size);
+        vs->set_session_cache_timeout(input_session_cache_timeout);
+
+        bool return_ssl_config = vs->set_ssl_config();
+    
+        //! set_ssl_config return data
+        // unit_test[146] set_ssl_config error (set_password_callback)
+        BOOST_CHECK_EQUAL( return_ssl_config, false );
+        // LOG:Set password callback error
+
+    }
+
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "set_ssl_config error (private_key_file)" << std::endl;
+    std::cout << "  target : Set private key file and filetype error" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    // set_ssl_config error (private_key_file)
+    {
+        std::string input_ca_file = "CAfile.pem";
+        std::string input_ca_dir = "/home/komata/KomataCA/";
+        std::string input_cert_chain_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_cert_chain_file = "cert.pem";
+        std::string input_private_key_dir = "/home/komata/KomataCA/SERVER/";
+//        std::string input_private_key_file = "server.key";
+        std::string input_private_key_file = "hoge.key";
+        boost::asio::ssl::context::file_format
+                    input_private_key_filetype = DEFAULT_SSL_PRIVATE_KEY_FILETYPE;
+        int         input_verify_options = SSL_VERIFY_PEER;
+
+        std::string input_private_key_passwd_dir  = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_passwd_file = "passwd.txt";
+
+        int         input_verify_cert_depth = 4;
+        long int    input_ssl_options = (SSL_OP_ALL|SSL_OP_NO_SSLv2|SSL_OP_SINGLE_DH_USE);
+        bool        input_is_tmp_dh_use = false;
+        std::string input_tmp_dh_dir = "/home/komata/KomataCA/";
+        std::string input_tmp_dh_file = "dh512.pem";
+        std::string input_cipher_list = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH";
+        bool        input_is_session_cache_use = true;
+        long        input_session_cache_mode = (SSL_SESS_CACHE_SERVER | SSL_SESS_CACHE_NO_AUTO_CLEAR);
+        long        input_session_cache_size = 20480;
+        long        input_session_cache_timeout = 300;
+
+        vs->set_ca_file(input_ca_file);
+        vs->set_ca_dir(input_ca_dir);
+        vs->set_cert_chain_dir(input_cert_chain_dir);
+        vs->set_cert_chain_file(input_cert_chain_file);
+        vs->set_private_key_dir(input_private_key_dir);
+        vs->set_private_key_file(input_private_key_file);
+        vs->set_private_key_filetype(input_private_key_filetype);
+        vs->set_private_key_passwd_dir(input_private_key_passwd_dir);
+        vs->set_private_key_passwd_file(input_private_key_passwd_file);
+        vs->set_verify_options(input_verify_options);
+        vs->set_verify_cert_depth(input_verify_cert_depth);
+        vs->set_ssl_options(input_ssl_options);
+        vs->set_is_tmp_dh_use(input_is_tmp_dh_use);
+        vs->set_tmp_dh_dir(input_tmp_dh_dir);
+        vs->set_tmp_dh_file(input_tmp_dh_file);
+        vs->set_cipher_list(input_cipher_list);
+        vs->set_is_session_cache_use(input_is_session_cache_use);
+        vs->set_session_cache_mode(input_session_cache_mode);
+        vs->set_session_cache_size(input_session_cache_size);
+        vs->set_session_cache_timeout(input_session_cache_timeout);
+
+        bool return_ssl_config = vs->set_ssl_config();
+    
+        //! set_ssl_config return data
+        // unit_test[147] set_ssl_config error (private_key_file)
+        BOOST_CHECK_EQUAL( return_ssl_config, false );
+        // LOG:Set private key file and filetype error
+
+    }
+
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "set_ssl_config error (verify_options)" << std::endl;
+    std::cout << "  target : Set verify option error" << std::endl;
+    std::cout << "  check on desk" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    // set_ssl_config error (verify_options)
+    {
+        std::string input_ca_file = "CAfile.pem";
+        std::string input_ca_dir = "/home/komata/KomataCA/";
+        std::string input_cert_chain_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_cert_chain_file = "cert.pem";
+        std::string input_private_key_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_file = "server.key";
+        boost::asio::ssl::context::file_format
+                    input_private_key_filetype = DEFAULT_SSL_PRIVATE_KEY_FILETYPE;
+//        int         input_verify_options = SSL_VERIFY_PEER;
+        int         input_verify_options = 0;
+
+        std::string input_private_key_passwd_dir  = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_passwd_file = "passwd.txt";
+
+        int         input_verify_cert_depth = 4;
+        long int    input_ssl_options = (SSL_OP_ALL|SSL_OP_NO_SSLv2|SSL_OP_SINGLE_DH_USE);
+        bool        input_is_tmp_dh_use = false;
+        std::string input_tmp_dh_dir = "/home/komata/KomataCA/";
+        std::string input_tmp_dh_file = "dh512.pem";
+        std::string input_cipher_list = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH";
+        bool        input_is_session_cache_use = true;
+        long        input_session_cache_mode = (SSL_SESS_CACHE_SERVER | SSL_SESS_CACHE_NO_AUTO_CLEAR);
+        long        input_session_cache_size = 20480;
+        long        input_session_cache_timeout = 300;
+
+        vs->set_ca_file(input_ca_file);
+        vs->set_ca_dir(input_ca_dir);
+        vs->set_cert_chain_dir(input_cert_chain_dir);
+        vs->set_cert_chain_file(input_cert_chain_file);
+        vs->set_private_key_dir(input_private_key_dir);
+        vs->set_private_key_file(input_private_key_file);
+        vs->set_private_key_filetype(input_private_key_filetype);
+        vs->set_private_key_passwd_dir(input_private_key_passwd_dir);
+        vs->set_private_key_passwd_file(input_private_key_passwd_file);
+        vs->set_verify_options(input_verify_options);
+        vs->set_verify_cert_depth(input_verify_cert_depth);
+        vs->set_ssl_options(input_ssl_options);
+        vs->set_is_tmp_dh_use(input_is_tmp_dh_use);
+        vs->set_tmp_dh_dir(input_tmp_dh_dir);
+        vs->set_tmp_dh_file(input_tmp_dh_file);
+        vs->set_cipher_list(input_cipher_list);
+        vs->set_is_session_cache_use(input_is_session_cache_use);
+        vs->set_session_cache_mode(input_session_cache_mode);
+        vs->set_session_cache_size(input_session_cache_size);
+        vs->set_session_cache_timeout(input_session_cache_timeout);
+
+        bool return_ssl_config = vs->set_ssl_config();
+
+        // verify_options all value success
+        // verify_options error case confirmation on a desk
+        // unit_test[148] set_ssl_config error (verify_options)
+        BOOST_CHECK_EQUAL( return_ssl_config, true );
+        // LOG:Set verify option error
+
+    }
+
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "set_ssl_config error (ssl_options)" << std::endl;
+    std::cout << "  target : Set SSL option error" << std::endl;
+    std::cout << "  check on desk" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    // set_ssl_config error (ssl_options)
+    {
+        std::string input_ca_file = "CAfile.pem";
+        std::string input_ca_dir = "/home/komata/KomataCA/";
+        std::string input_cert_chain_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_cert_chain_file = "cert.pem";
+        std::string input_private_key_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_file = "server.key";
+        boost::asio::ssl::context::file_format
+                    input_private_key_filetype = DEFAULT_SSL_PRIVATE_KEY_FILETYPE;
+        int         input_verify_options = SSL_VERIFY_PEER;
+
+        std::string input_private_key_passwd_dir  = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_passwd_file = "passwd.txt";
+
+        int         input_verify_cert_depth = 4;
+//        long int    input_ssl_options = (SSL_OP_ALL|SSL_OP_NO_SSLv2|SSL_OP_SINGLE_DH_USE);
+        long int    input_ssl_options = 0;
+        bool        input_is_tmp_dh_use = false;
+        std::string input_tmp_dh_dir = "/home/komata/KomataCA/";
+        std::string input_tmp_dh_file = "dh512.pem";
+        std::string input_cipher_list = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH";
+        bool        input_is_session_cache_use = true;
+        long        input_session_cache_mode = (SSL_SESS_CACHE_SERVER | SSL_SESS_CACHE_NO_AUTO_CLEAR);
+        long        input_session_cache_size = 20480;
+        long        input_session_cache_timeout = 300;
+
+        vs->set_ca_file(input_ca_file);
+        vs->set_ca_dir(input_ca_dir);
+        vs->set_cert_chain_dir(input_cert_chain_dir);
+        vs->set_cert_chain_file(input_cert_chain_file);
+        vs->set_private_key_dir(input_private_key_dir);
+        vs->set_private_key_file(input_private_key_file);
+        vs->set_private_key_filetype(input_private_key_filetype);
+        vs->set_private_key_passwd_dir(input_private_key_passwd_dir);
+        vs->set_private_key_passwd_file(input_private_key_passwd_file);
+        vs->set_verify_options(input_verify_options);
+        vs->set_verify_cert_depth(input_verify_cert_depth);
+        vs->set_ssl_options(input_ssl_options);
+        vs->set_is_tmp_dh_use(input_is_tmp_dh_use);
+        vs->set_tmp_dh_dir(input_tmp_dh_dir);
+        vs->set_tmp_dh_file(input_tmp_dh_file);
+        vs->set_cipher_list(input_cipher_list);
+        vs->set_is_session_cache_use(input_is_session_cache_use);
+        vs->set_session_cache_mode(input_session_cache_mode);
+        vs->set_session_cache_size(input_session_cache_size);
+        vs->set_session_cache_timeout(input_session_cache_timeout);
+
+        bool return_ssl_config = vs->set_ssl_config();
+
+        // ssl_options all value success
+        // ssl_options error case confirmation on a desk
+        // unit_test[149] set_ssl_config error (ssl_options) dummy test
+        BOOST_CHECK_EQUAL( return_ssl_config, true );
+
+    }
+
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "set_ssl_config error (temporary Diffie-Hellman parameters file)" << std::endl;
+    std::cout << "  target : Set tmp DH file error" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    // set_ssl_config error (temporary Diffie-Hellman parameters file)
+    {
+        std::string input_ca_file = "CAfile.pem";
+        std::string input_ca_dir = "/home/komata/KomataCA/";
+        std::string input_cert_chain_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_cert_chain_file = "cert.pem";
+        std::string input_private_key_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_file = "server.key";
+        boost::asio::ssl::context::file_format
+                    input_private_key_filetype = DEFAULT_SSL_PRIVATE_KEY_FILETYPE;
+        int         input_verify_options = SSL_VERIFY_PEER;
+
+        std::string input_private_key_passwd_dir  = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_passwd_file = "passwd.txt";
+
+        int         input_verify_cert_depth = 4;
+        long int    input_ssl_options = (SSL_OP_ALL|SSL_OP_NO_SSLv2|SSL_OP_SINGLE_DH_USE);
+        bool        input_is_tmp_dh_use = true;
+        std::string input_tmp_dh_dir = "/home/komata/KomataCA/";
+//        std::string input_tmp_dh_file = "dh512.pem";
+        std::string input_tmp_dh_file = "hoge.pem";
+        std::string input_cipher_list = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH";
+        bool        input_is_session_cache_use = true;
+        long        input_session_cache_mode = (SSL_SESS_CACHE_SERVER | SSL_SESS_CACHE_NO_AUTO_CLEAR);
+        long        input_session_cache_size = 20480;
+        long        input_session_cache_timeout = 300;
+
+        vs->set_ca_file(input_ca_file);
+        vs->set_ca_dir(input_ca_dir);
+        vs->set_cert_chain_dir(input_cert_chain_dir);
+        vs->set_cert_chain_file(input_cert_chain_file);
+        vs->set_private_key_dir(input_private_key_dir);
+        vs->set_private_key_file(input_private_key_file);
+        vs->set_private_key_filetype(input_private_key_filetype);
+        vs->set_private_key_passwd_dir(input_private_key_passwd_dir);
+        vs->set_private_key_passwd_file(input_private_key_passwd_file);
+        vs->set_verify_options(input_verify_options);
+        vs->set_verify_cert_depth(input_verify_cert_depth);
+        vs->set_ssl_options(input_ssl_options);
+        vs->set_is_tmp_dh_use(input_is_tmp_dh_use);
+        vs->set_tmp_dh_dir(input_tmp_dh_dir);
+        vs->set_tmp_dh_file(input_tmp_dh_file);
+        vs->set_cipher_list(input_cipher_list);
+        vs->set_is_session_cache_use(input_is_session_cache_use);
+        vs->set_session_cache_mode(input_session_cache_mode);
+        vs->set_session_cache_size(input_session_cache_size);
+        vs->set_session_cache_timeout(input_session_cache_timeout);
+
+        bool return_ssl_config = vs->set_ssl_config();
+    
+        //! set_ssl_config return data
+        // unit_test[150] set_ssl_config error (temporary Diffie-Hellman parameters file)
+        BOOST_CHECK_EQUAL( return_ssl_config, false );
+        // LOG:Set tmp DH file error
+
+    }
+
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "set_ssl_config error (cipher_list)" << std::endl;
+    std::cout << "  target : Set cipher list error" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    // set_ssl_config error (cipher_list)
+    {
+    
+        std::string input_ca_file = "CAfile.pem";
+        std::string input_ca_dir = "/home/komata/KomataCA/";
+        std::string input_cert_chain_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_cert_chain_file = "cert.pem";
+        std::string input_private_key_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_file = "server.key";
+        boost::asio::ssl::context::file_format
+                    input_private_key_filetype = DEFAULT_SSL_PRIVATE_KEY_FILETYPE;
+        int         input_verify_options = SSL_VERIFY_PEER;
+
+        std::string input_private_key_passwd_dir  = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_passwd_file = "passwd.txt";
+
+        int         input_verify_cert_depth = 4;
+        long int    input_ssl_options = (SSL_OP_ALL|SSL_OP_NO_SSLv2|SSL_OP_SINGLE_DH_USE);
+        bool        input_is_tmp_dh_use = true;
+        std::string input_tmp_dh_dir = "/home/komata/KomataCA/";
+        std::string input_tmp_dh_file = "dh512.pem";
+        std::string input_cipher_list = "xxxxxxxxxxxxxxx";
+        bool        input_is_session_cache_use = true;
+        long        input_session_cache_mode = (SSL_SESS_CACHE_SERVER | SSL_SESS_CACHE_NO_AUTO_CLEAR);
+        long        input_session_cache_size = 20480;
+        long        input_session_cache_timeout = 300;
+
+        vs->set_ca_file(input_ca_file);
+        vs->set_ca_dir(input_ca_dir);
+        vs->set_cert_chain_dir(input_cert_chain_dir);
+        vs->set_cert_chain_file(input_cert_chain_file);
+        vs->set_private_key_dir(input_private_key_dir);
+        vs->set_private_key_file(input_private_key_file);
+        vs->set_private_key_filetype(input_private_key_filetype);
+        vs->set_private_key_passwd_dir(input_private_key_passwd_dir);
+        vs->set_private_key_passwd_file(input_private_key_passwd_file);
+        vs->set_verify_options(input_verify_options);
+        vs->set_verify_cert_depth(input_verify_cert_depth);
+        vs->set_ssl_options(input_ssl_options);
+        vs->set_is_tmp_dh_use(input_is_tmp_dh_use);
+        vs->set_tmp_dh_dir(input_tmp_dh_dir);
+        vs->set_tmp_dh_file(input_tmp_dh_file);
+        vs->set_cipher_list(input_cipher_list);
+        vs->set_is_session_cache_use(input_is_session_cache_use);
+        vs->set_session_cache_mode(input_session_cache_mode);
+        vs->set_session_cache_size(input_session_cache_size);
+        vs->set_session_cache_timeout(input_session_cache_timeout);
+
+        bool return_ssl_config = vs->set_ssl_config();
+    
+        //! set_ssl_config return data
+        // unit_test[151] set_ssl_config error (cipher_list)
+        BOOST_CHECK_EQUAL( return_ssl_config, false );
+        // LOG:Set cipher list error
+
+   }
+
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "set_ssl_config error (session cache)" << std::endl;
+    std::cout << "  target : Set session id context error" << std::endl;
+    std::cout << "  check on desk" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    // set_ssl_config error (session cache)
+    {
+        std::string input_ca_file = "CAfile.pem";
+        std::string input_ca_dir = "/home/komata/KomataCA/";
+        std::string input_cert_chain_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_cert_chain_file = "cert.pem";
+        std::string input_private_key_dir = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_file = "server.key";
+        boost::asio::ssl::context::file_format
+                    input_private_key_filetype = DEFAULT_SSL_PRIVATE_KEY_FILETYPE;
+        int         input_verify_options = SSL_VERIFY_PEER;
+
+        std::string input_private_key_passwd_dir  = "/home/komata/KomataCA/SERVER/";
+        std::string input_private_key_passwd_file = "passwd.txt";
+
+        int         input_verify_cert_depth = 4;
+        long int    input_ssl_options = (SSL_OP_ALL|SSL_OP_NO_SSLv2|SSL_OP_SINGLE_DH_USE);
+        bool        input_is_tmp_dh_use = true;
+        std::string input_tmp_dh_dir = "/home/komata/KomataCA/";
+        std::string input_tmp_dh_file = "dh512.pem";
+        std::string input_cipher_list = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH";
+        bool        input_is_session_cache_use = true;
+        long        input_session_cache_mode = (SSL_SESS_CACHE_SERVER | SSL_SESS_CACHE_NO_AUTO_CLEAR);
+        long        input_session_cache_size = 20480;
+        long        input_session_cache_timeout = 300;
+
+        vs->set_ca_file(input_ca_file);
+        vs->set_ca_dir(input_ca_dir);
+        vs->set_cert_chain_dir(input_cert_chain_dir);
+        vs->set_cert_chain_file(input_cert_chain_file);
+        vs->set_private_key_dir(input_private_key_dir);
+        vs->set_private_key_file(input_private_key_file);
+        vs->set_private_key_filetype(input_private_key_filetype);
+        vs->set_private_key_passwd_dir(input_private_key_passwd_dir);
+        vs->set_private_key_passwd_file(input_private_key_passwd_file);
+        vs->set_verify_options(input_verify_options);
+        vs->set_verify_cert_depth(input_verify_cert_depth);
+        vs->set_ssl_options(input_ssl_options);
+        vs->set_is_tmp_dh_use(input_is_tmp_dh_use);
+        vs->set_tmp_dh_dir(input_tmp_dh_dir);
+        vs->set_tmp_dh_file(input_tmp_dh_file);
+        vs->set_cipher_list(input_cipher_list);
+        vs->set_is_session_cache_use(input_is_session_cache_use);
+        vs->set_session_cache_mode(input_session_cache_mode);
+        vs->set_session_cache_size(input_session_cache_size);
+        vs->set_session_cache_timeout(input_session_cache_timeout);
+
+        bool return_ssl_config = vs->set_ssl_config();
+
+        // session id context error case confirmation on a desk
+        // unit_test[152] set_ssl_config error (session cache) dummy test
+        BOOST_CHECK_EQUAL( return_ssl_config, true );
+
+    }
+
+
+
+    BOOST_MESSAGE( "-------??" );
+    delete vs;
+
+}
+
+
+//test case1  create,initialize,run,stop,finalize,destroy(ssl mode normal case)
+void    virtualservice_tcp_initialize_to_finalize(){
+    counter = 1;
+
+    debugg_flug_struct::getInstance().pmcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().smcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().param_exist_flag() = false;
+
+    l7vs::l7vsd                    vsd;
+    boost::asio::io_service        dispatcher;
+    l7vs::replication            rep;
+    l7vs::virtualservice_element    element;
+    //set element value
+    element.udpmode                    = false;
+    element.tcp_accept_endpoint        = tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    element.udp_recv_endpoint        = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    element.realserver_vector.clear();
+    element.protocol_module_name    = "PMtest1";
+    element.schedule_module_name    = "SMtest1";
+    element.protocol_args.clear();
+    element.protocol_args.push_back( "testarg" );
+    element.protocol_args.push_back( "testarg2" );
+    element.sorry_maxconnection        = 1234LL;
+    element.sorry_endpoint            = tcp_ep_type( boost::asio::ip::address::from_string( "10.144.169.87" ), (8080) );
+    element.sorry_flag                = false;
+    element.qos_upstream            = 65535ULL;
+    element.qos_downstream            = 32767ULL;
+   
+    element.ssl_file_name = "./sslfiles/ssl_conf.cf";
+    // unit_test[153]  object create
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------1" );
+    l7vs::vs_tcp*    vs = new l7vs::vs_tcp( vsd, rep, element );
+
+    BOOST_CHECK_EQUAL( &vsd, &(vs->get_vsd()) );
+    BOOST_CHECK_EQUAL( &rep, &(vs->get_rep()) );
+    BOOST_CHECK( element == vs->get_element() );
+    l7vs::error_code    vs_err;
+    // unit_test[154]  initialize method call
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------2" );
+    BOOST_CHECK( NULL == vs->get_protocol_module() );
+    BOOST_CHECK( NULL == vs->get_schedule_module() );
+
+    result.flag = false;
+    vs_err.setter(false,"");
+    vs->initialize( vs_err );
+
+    bool result_flg;
+
+    if( vs_err == true ) {
+        result_flg = true;
+    } else if ( vs_err == false ) {
+        result_flg = false;
+    }
+
+    BOOST_CHECK( result_flg == false );
+
+    //protocol_module_controlのモジュールロードを呼んでいるか(モジュールロード正常終了)
+    BOOST_CHECK( NULL != vs->get_protocol_module() );
+    //schedule_module_controlのモジュールロードを呼んでいるか(モジュールロード正常終了)
+    BOOST_CHECK( NULL != vs->get_schedule_module() );
+
+    unsigned int pool_default_size = l7vs::virtualservice_base::SESSION_POOL_NUM_DEFAULT;
+    unsigned int pool_size = vs->get_pool_sessions().size();
+
+    //session_poolを作成しているか(デフォルトサイズで作成)
+    BOOST_CHECK( pool_default_size == pool_size );
+
+    // set option
+    bool& defer_accept_opt = vs->get_defer_accept_opt();
+    defer_accept_opt = true;
+    int& defer_accept_val = vs->get_defer_accept_val();
+    defer_accept_val = 1;
+
+    // unit_test[155]  run method test
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------3" );
+    boost::thread    vs_main( &l7vs::vs_tcp::run, vs );
+
+    usleep( 1500000 );
+    //1秒待って、ProtocolModule/ScheduleModuleのreplication_interruptが呼ばれることを確認
+    //デフォルト設定は500msなので2回
+    BOOST_MESSAGE( debugg_flug_struct::getInstance().get_pm_rep_count() );
+    BOOST_MESSAGE( debugg_flug_struct::getInstance().get_sm_rep_count() );
+    BOOST_CHECK( 2 == debugg_flug_struct::getInstance().get_pm_rep_count() );
+    BOOST_CHECK( 2 == debugg_flug_struct::getInstance().get_sm_rep_count() );
+
+    // unit_test[156]  set TCP_DEFER_ACCEPT test
+    int val = 0;
+    size_t len = sizeof(val);
+    boost::system::error_code ec;
+    boost::asio::detail::socket_ops::getsockopt(vs->get_acceptor().native(),IPPROTO_TCP,TCP_DEFER_ACCEPT,&val,&len,ec);
+    BOOST_CHECK(!ec);
+    BOOST_CHECK(val);
+    
+    // unit_test[157]  stop method test
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------4" );
+    vs->stop();
+    usleep( 1000 );
+
+    // unit_test[158]  release_session method test(run直後はwaiting_sessionsに入っているため、release_sessionではプールに戻らない)
+    std::cout << counter++ << std::endl;
+//     BOOST_MESSAGE( "-------5" );
+//     BOOST_CHECK( vs->get_pool_sessions().size() == (l7vs::virtualservice_base::SESSION_POOL_NUM_DEFAULT-1) );
+//     BOOST_CHECK( vs->get_waiting_sessions().size() == 1 );
+//     BOOST_CHECK( vs->get_active_sessions().size() == 0 );
+//     vs->release_session( vs->get_waiting_sessions().begin()->second->get_upthread_id() );
+//     BOOST_CHECK( vs->get_pool_sessions().size() == static_cast<size_t>( l7vs::virtualservice_base::SESSION_POOL_NUM_DEFAULT) );
+//     BOOST_CHECK( vs->get_active_sessions().size() == 0 );
+//     BOOST_CHECK( vs->get_waiting_sessions().size() == 0 );
+
+    // unit_test[159]  stop method test(call twice)
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------6" );
+    vs->stop();
+
+    vs_main.join();
+
+    // unit_test[160]  finalize method call
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------7" );
+    vs_err.setter(false,"");
+    vs->finalize( vs_err );
+    BOOST_CHECK( vs_err == false );
+
+    // unit_test[161]  finalizeを2回連続で呼んでみる
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------8" );
+    vs_err.setter(false,"");
+    vs->finalize( vs_err );
+    BOOST_CHECK( vs_err == false );
+
+
+    // unit_test[162]  object destroy
+    std::cout << counter++ << std::endl;
+    BOOST_MESSAGE( "-------9" );
+    delete vs;
+}
+
+//send access_log_flag ON/OFF to TCP session
+void    virtualservice_tcp_handle_accept_test(){
+
+    //access_log_flag:true
+    {
+    debugg_flug_struct::getInstance().param_exist_flag() = false;
+    debugg_flug_struct::getInstance().pmcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().smcontrol_err_flag()    = false;
+
+    l7vs::error_code            vs_err;
+    boost::system::error_code   test_err;
+
+    std::stringstream    tmp_tcp_ep;
+    std::stringstream    tmp_udp_ep;
+    std::stringstream    tmp_sorry_ep;
+
+    l7vs::l7vsd                  vsd;
+    boost::asio::io_service      dispatcher;
+    l7vs::replication            rep;
+    l7vs::virtualservice_element elem1;
+
+    elem1.udpmode                = false;
+    elem1.tcp_accept_endpoint    = 
+            tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem1.udp_recv_endpoint      = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem1.realserver_vector.clear();
+    elem1.protocol_module_name   = "PMtest1";
+    elem1.schedule_module_name   = "SMtest1";
+    elem1.protocol_args.clear();
+    elem1.sorry_maxconnection    = 1234LL;
+    elem1.sorry_endpoint         = 
+            tcp_ep_type( boost::asio::ip::address::from_string( "AFAF:0E08::8FDE" ), (8080) );
+    elem1.sorry_flag             = false;
+    elem1.qos_upstream           = 65535ULL;
+    elem1.qos_downstream         = 32767ULL;
+    elem1.ssl_file_name          = "";
+    elem1.access_log_flag        = 1;
+    elem1.access_log_file_name   = "access_log.log";
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-type" , "size" ) );
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-backup-index" , "1" ) );
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-filesize" , "10M" ) );
+
+    //vs作成
+    l7vs::vs_tcp*    vs = new l7vs::vs_tcp( vsd, rep, elem1 );
+    BOOST_CHECK_EQUAL( &vsd, &(vs->get_vsd()) );
+    BOOST_CHECK_EQUAL( &rep, &(vs->get_rep()) );
+    BOOST_CHECK( elem1 == vs->get_element() );
+
+    vs_err.setter(false,"");
+    vs->initialize( vs_err );
+
+    boost::thread    vs_main( &l7vs::vs_tcp::run, vs );
+    usleep( 2000000 );
+
+    // unit_test[163] send access_log_flag ON to TCP session
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "handle_accept_test (access_log_flag ON)" << std::endl;
+    std::cout << "  target:set_virtual_service_message called : ACCESS_LOG_ON" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    boost::thread    cl_thread( &client );
+    // session_access_log_output_mode_change STUB OUTPUT
+    // set_virtual_service_message called : ACCESS_LOG_ON
+
+    //2秒待ってsessionプールのサイズをチェック
+    usleep( 2000000 );
+    BOOST_CHECK( vs->get_pool_sessions().size() == l7vs::virtualservice_base::SESSION_POOL_NUM_DEFAULT-2 );
+
+    debugg_flug_struct::getInstance().stub_loglevel() = l7vs::LOG_LV_DEBUG;
+    //1秒待ってmainをSTOP
+    usleep( 1000000 );
+    vs->stop();
+
+    usleep( 1000 );
+    cl_thread.join();
+    vs_main.join();
+
+    vs_err.setter(false,"");
+    vs->finalize( vs_err );
+
+    delete vs;
+    }
+    //access_log_flag:false
+    {
+    debugg_flug_struct::getInstance().param_exist_flag() = false;
+    debugg_flug_struct::getInstance().pmcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().smcontrol_err_flag()    = false;
+
+    l7vs::error_code            vs_err;
+    boost::system::error_code   test_err;
+
+    std::stringstream    tmp_tcp_ep;
+    std::stringstream    tmp_udp_ep;
+    std::stringstream    tmp_sorry_ep;
+
+    l7vs::l7vsd                  vsd;
+    boost::asio::io_service      dispatcher;
+    l7vs::replication            rep;
+    l7vs::virtualservice_element elem1;
+
+    elem1.udpmode                = false;
+    elem1.tcp_accept_endpoint    = 
+            tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem1.udp_recv_endpoint      = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem1.realserver_vector.clear();
+    elem1.protocol_module_name   = "PMtest1";
+    elem1.schedule_module_name   = "SMtest1";
+    elem1.protocol_args.clear();
+    elem1.sorry_maxconnection    = 1234LL;
+    elem1.sorry_endpoint         = 
+            tcp_ep_type( boost::asio::ip::address::from_string( "AFAF:0E08::8FDE" ), (8080) );
+    elem1.sorry_flag             = false;
+    elem1.qos_upstream           = 65535ULL;
+    elem1.qos_downstream         = 32767ULL;
+    elem1.ssl_file_name          = "";
+    elem1.access_log_flag        = 0;
+    elem1.access_log_file_name   = "access_log.log";
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-type" , "size" ) );
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-backup-index" , "1" ) );
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-filesize" , "10M" ) );
+
+    //vs作成
+    l7vs::vs_tcp*    vs = new l7vs::vs_tcp( vsd, rep, elem1 );
+    BOOST_CHECK_EQUAL( &vsd, &(vs->get_vsd()) );
+    BOOST_CHECK_EQUAL( &rep, &(vs->get_rep()) );
+    BOOST_CHECK( elem1 == vs->get_element() );
+
+    vs_err.setter(false,"");
+    vs->initialize( vs_err );
+
+    boost::thread    vs_main( &l7vs::vs_tcp::run, vs );
+    usleep( 2000000 );
+
+    // unit_test[164] send access_log_flag OFF to TCP session
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "handle_accept_test (access_log_flag OFF)" << std::endl;
+    std::cout << "  target:set_virtual_service_message called : ACCESS_LOG_OFF" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    boost::thread    cl_thread( &client );
+    // session_access_log_output_mode_change STUB OUTPUT
+    // set_virtual_service_message called : ACCESS_LOG_OFF
+
+    //2秒待ってsessionプールのサイズをチェック
+    usleep( 2000000 );
+    BOOST_CHECK( vs->get_pool_sessions().size() == l7vs::virtualservice_base::SESSION_POOL_NUM_DEFAULT-2 );
+
+    debugg_flug_struct::getInstance().stub_loglevel() = l7vs::LOG_LV_DEBUG;
+    //1秒待ってmainをSTOP
+    usleep( 1000000 );
+    vs->stop();
+
+    usleep( 1000 );
+    cl_thread.join();
+    vs_main.join();
+
+    vs_err.setter(false,"");
+    vs->finalize( vs_err );
+
+    delete vs;
+    }
+}
+
+// l7vs::virtualservice_tcp::initialize test
+void    virtualservice_tcp_initialize_test(){
+
+    //flag=ON,file=not empty,key=""
+    {
+    debugg_flug_struct::getInstance().param_exist_flag() = false;
+    debugg_flug_struct::getInstance().pmcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().smcontrol_err_flag()    = false;
+
+    l7vs::error_code            vs_err;
+    boost::system::error_code   test_err;
+
+    std::stringstream    tmp_tcp_ep;
+    std::stringstream    tmp_udp_ep;
+    std::stringstream    tmp_sorry_ep;
+
+    l7vs::l7vsd                  vsd;
+    boost::asio::io_service      dispatcher;
+    l7vs::replication            rep;
+    l7vs::virtualservice_element elem1;
+
+    elem1.udpmode                = false;
+    elem1.tcp_accept_endpoint    = 
+            tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem1.udp_recv_endpoint      = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem1.realserver_vector.clear();
+    elem1.protocol_module_name   = "PMtest1";
+    elem1.schedule_module_name   = "SMtest1";
+    elem1.protocol_args.clear();
+    elem1.sorry_maxconnection    = 1234LL;
+    elem1.sorry_endpoint         = 
+            tcp_ep_type( boost::asio::ip::address::from_string( "AFAF:0E08::8FDE" ), (8080) );
+    elem1.sorry_flag             = false;
+    elem1.qos_upstream           = 65535ULL;
+    elem1.qos_downstream         = 32767ULL;
+    elem1.ssl_file_name          = "";
+    elem1.access_log_flag        = 1;
+    elem1.access_log_file_name   = "access_log.log";
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-type" , "size" ) );
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-backup-index" , "1" ) );
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-filesize" , "10M" ) );
+    elem1.access_log_rotate_key_info = "";
+    elem1.access_log_rotate_verbose_info = "dummy";
+
+    //vs作成
+    l7vs::vs_tcp*    vs = new l7vs::vs_tcp( vsd, rep, elem1 );
+    BOOST_CHECK_EQUAL( &vsd, &(vs->get_vsd()) );
+    BOOST_CHECK_EQUAL( &rep, &(vs->get_rep()) );
+    BOOST_CHECK( elem1 == vs->get_element() );
+
+    vs_err.setter(false,"");
+    // unit_test[165] initialize (flag=ON,file=not empty,key="")
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "initialize_test (flag=ON,file=not empty,key=\"\")" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    vs->initialize( vs_err );
+
+    BOOST_CHECK_EQUAL( vs->get_access_log_flag(), true );
+    BOOST_CHECK_EQUAL( vs->get_element().access_log_rotate_key_info, "none" );
+    BOOST_CHECK_EQUAL( vs->get_element().access_log_rotate_verbose_info, "" );
+    BOOST_CHECK_EQUAL( vs->get_access_log_file_name(), vs->get_element().access_log_file_name );
+    BOOST_CHECK( vs->get_access_log_rotate_arguments() == elem1.access_log_rotate_arguments );
+
+    boost::thread    vs_main( &l7vs::vs_tcp::run, vs );
+    usleep( 2000000 );
+
+    boost::thread    cl_thread( &client );
+
+    //2秒待ってsessionプールのサイズをチェック
+    usleep( 2000000 );
+    BOOST_CHECK( vs->get_pool_sessions().size() == l7vs::virtualservice_base::SESSION_POOL_NUM_DEFAULT-2 );
+
+    debugg_flug_struct::getInstance().stub_loglevel() = l7vs::LOG_LV_DEBUG;
+    //1秒待ってmainをSTOP
+    usleep( 1000000 );
+    vs->stop();
+
+    usleep( 1000 );
+    cl_thread.join();
+    vs_main.join();
+
+    vs_err.setter(false,"");
+    vs->finalize( vs_err );
+
+    delete vs;
+    }
+
+    //flag=ON,file=not empty,key="key_info"
+    {
+    debugg_flug_struct::getInstance().param_exist_flag() = false;
+    debugg_flug_struct::getInstance().pmcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().smcontrol_err_flag()    = false;
+
+    l7vs::error_code            vs_err;
+    boost::system::error_code   test_err;
+
+    std::stringstream    tmp_tcp_ep;
+    std::stringstream    tmp_udp_ep;
+    std::stringstream    tmp_sorry_ep;
+
+    l7vs::l7vsd                  vsd;
+    boost::asio::io_service      dispatcher;
+    l7vs::replication            rep;
+    l7vs::virtualservice_element elem1;
+
+    elem1.udpmode                = false;
+    elem1.tcp_accept_endpoint    = 
+            tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem1.udp_recv_endpoint      = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem1.realserver_vector.clear();
+    elem1.protocol_module_name   = "PMtest1";
+    elem1.schedule_module_name   = "SMtest1";
+    elem1.protocol_args.clear();
+    elem1.sorry_maxconnection    = 1234LL;
+    elem1.sorry_endpoint         = 
+            tcp_ep_type( boost::asio::ip::address::from_string( "AFAF:0E08::8FDE" ), (8080) );
+    elem1.sorry_flag             = false;
+    elem1.qos_upstream           = 65535ULL;
+    elem1.qos_downstream         = 32767ULL;
+    elem1.ssl_file_name          = "";
+    elem1.access_log_flag        = 1;
+    elem1.access_log_file_name   = "access_log.log";
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-type" , "size" ) );
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-backup-index" , "1" ) );
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-filesize" , "10M" ) );
+    elem1.access_log_rotate_key_info = "keyinfo";
+    elem1.access_log_rotate_verbose_info = "dummy";
+
+    //vs作成
+    l7vs::vs_tcp*    vs = new l7vs::vs_tcp( vsd, rep, elem1 );
+    BOOST_CHECK_EQUAL( &vsd, &(vs->get_vsd()) );
+    BOOST_CHECK_EQUAL( &rep, &(vs->get_rep()) );
+    BOOST_CHECK( elem1 == vs->get_element() );
+
+    vs_err.setter(false,"");
+    // unit_test[166] initialize (flag=ON,file=not empty,key="keyinfo")
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "initialize_test (flag=ON,file=not empty,key=\"keyinfo\")" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    vs->initialize( vs_err );
+
+    BOOST_CHECK_EQUAL( vs->get_access_log_flag(), true );
+    BOOST_CHECK_EQUAL( vs->get_element().access_log_rotate_key_info, "keyinfo" );
+    BOOST_CHECK_EQUAL( vs->get_element().access_log_rotate_verbose_info, "keyinfo" );
+    BOOST_CHECK_EQUAL( vs->get_access_log_file_name(), vs->get_element().access_log_file_name );
+    BOOST_CHECK( vs->get_access_log_rotate_arguments() == elem1.access_log_rotate_arguments );
+
+    boost::thread    vs_main( &l7vs::vs_tcp::run, vs );
+    usleep( 2000000 );
+
+    boost::thread    cl_thread( &client );
+
+    //2秒待ってsessionプールのサイズをチェック
+    usleep( 2000000 );
+    BOOST_CHECK( vs->get_pool_sessions().size() == l7vs::virtualservice_base::SESSION_POOL_NUM_DEFAULT-2 );
+
+    debugg_flug_struct::getInstance().stub_loglevel() = l7vs::LOG_LV_DEBUG;
+    //1秒待ってmainをSTOP
+    usleep( 1000000 );
+    vs->stop();
+
+    usleep( 1000 );
+    cl_thread.join();
+    vs_main.join();
+
+    vs_err.setter(false,"");
+    vs->finalize( vs_err );
+
+    delete vs;
+    }
+
+    //flag=OFF,file=not empty,key=""
+    {
+    debugg_flug_struct::getInstance().param_exist_flag() = false;
+    debugg_flug_struct::getInstance().pmcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().smcontrol_err_flag()    = false;
+
+    l7vs::error_code            vs_err;
+    boost::system::error_code   test_err;
+
+    std::stringstream    tmp_tcp_ep;
+    std::stringstream    tmp_udp_ep;
+    std::stringstream    tmp_sorry_ep;
+
+    l7vs::l7vsd                  vsd;
+    boost::asio::io_service      dispatcher;
+    l7vs::replication            rep;
+    l7vs::virtualservice_element elem1;
+
+    elem1.udpmode                = false;
+    elem1.tcp_accept_endpoint    = 
+            tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem1.udp_recv_endpoint      = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem1.realserver_vector.clear();
+    elem1.protocol_module_name   = "PMtest1";
+    elem1.schedule_module_name   = "SMtest1";
+    elem1.protocol_args.clear();
+    elem1.sorry_maxconnection    = 1234LL;
+    elem1.sorry_endpoint         = 
+            tcp_ep_type( boost::asio::ip::address::from_string( "AFAF:0E08::8FDE" ), (8080) );
+    elem1.sorry_flag             = false;
+    elem1.qos_upstream           = 65535ULL;
+    elem1.qos_downstream         = 32767ULL;
+    elem1.ssl_file_name          = "";
+    elem1.access_log_flag        = 0;
+    elem1.access_log_file_name   = "access_log.log";
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-type" , "size" ) );
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-backup-index" , "1" ) );
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-filesize" , "10M" ) );
+    elem1.access_log_rotate_key_info = "";
+    elem1.access_log_rotate_verbose_info = "dummy";
+
+    //vs作成
+    l7vs::vs_tcp*    vs = new l7vs::vs_tcp( vsd, rep, elem1 );
+    BOOST_CHECK_EQUAL( &vsd, &(vs->get_vsd()) );
+    BOOST_CHECK_EQUAL( &rep, &(vs->get_rep()) );
+    BOOST_CHECK( elem1 == vs->get_element() );
+
+    vs_err.setter(false,"");
+    // unit_test[167] initialize (flag=OFF,file=not empty,key="")
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "initialize_test (flag=OFF,file=not empty,key=\"\")" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    vs->initialize( vs_err );
+
+    BOOST_CHECK_EQUAL( vs->get_access_log_flag(), false );
+    BOOST_CHECK_EQUAL( vs->get_element().access_log_rotate_key_info, "none" );
+    BOOST_CHECK_EQUAL( vs->get_element().access_log_rotate_verbose_info, "" );
+    BOOST_CHECK_EQUAL( vs->get_access_log_file_name(), vs->get_element().access_log_file_name );
+    BOOST_CHECK( vs->get_access_log_rotate_arguments() == elem1.access_log_rotate_arguments );
+
+    boost::thread    vs_main( &l7vs::vs_tcp::run, vs );
+    usleep( 2000000 );
+
+    boost::thread    cl_thread( &client );
+
+    //2秒待ってsessionプールのサイズをチェック
+    usleep( 2000000 );
+    BOOST_CHECK( vs->get_pool_sessions().size() == l7vs::virtualservice_base::SESSION_POOL_NUM_DEFAULT-2 );
+
+    debugg_flug_struct::getInstance().stub_loglevel() = l7vs::LOG_LV_DEBUG;
+    //1秒待ってmainをSTOP
+    usleep( 1000000 );
+    vs->stop();
+
+    usleep( 1000 );
+    cl_thread.join();
+    vs_main.join();
+
+    vs_err.setter(false,"");
+    vs->finalize( vs_err );
+
+    delete vs;
+    }
+
+    //flag=OFF,file=not empty,key="keyinfo"
+    {
+    debugg_flug_struct::getInstance().param_exist_flag() = false;
+    debugg_flug_struct::getInstance().pmcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().smcontrol_err_flag()    = false;
+
+    l7vs::error_code            vs_err;
+    boost::system::error_code   test_err;
+
+    std::stringstream    tmp_tcp_ep;
+    std::stringstream    tmp_udp_ep;
+    std::stringstream    tmp_sorry_ep;
+
+    l7vs::l7vsd                  vsd;
+    boost::asio::io_service      dispatcher;
+    l7vs::replication            rep;
+    l7vs::virtualservice_element elem1;
+
+    elem1.udpmode                = false;
+    elem1.tcp_accept_endpoint    = 
+            tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem1.udp_recv_endpoint      = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem1.realserver_vector.clear();
+    elem1.protocol_module_name   = "PMtest1";
+    elem1.schedule_module_name   = "SMtest1";
+    elem1.protocol_args.clear();
+    elem1.sorry_maxconnection    = 1234LL;
+    elem1.sorry_endpoint         = 
+            tcp_ep_type( boost::asio::ip::address::from_string( "AFAF:0E08::8FDE" ), (8080) );
+    elem1.sorry_flag             = false;
+    elem1.qos_upstream           = 65535ULL;
+    elem1.qos_downstream         = 32767ULL;
+    elem1.ssl_file_name          = "";
+    elem1.access_log_flag        = 0;
+    elem1.access_log_file_name   = "access_log.log";
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-type" , "size" ) );
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-backup-index" , "1" ) );
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-filesize" , "10M" ) );
+    elem1.access_log_rotate_key_info = "keyinfo";
+    elem1.access_log_rotate_verbose_info = "dummy";
+
+    //vs作成
+    l7vs::vs_tcp*    vs = new l7vs::vs_tcp( vsd, rep, elem1 );
+    BOOST_CHECK_EQUAL( &vsd, &(vs->get_vsd()) );
+    BOOST_CHECK_EQUAL( &rep, &(vs->get_rep()) );
+    BOOST_CHECK( elem1 == vs->get_element() );
+
+    vs_err.setter(false,"");
+    // unit_test[168] initialize (flag=OFF,file=not empty,key="keyinfo")
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "initialize_test (flag=OFF,file=not empty,key=\"keyinfo\")" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    vs->initialize( vs_err );
+
+    BOOST_CHECK_EQUAL( vs->get_access_log_flag(), false );
+    BOOST_CHECK_EQUAL( vs->get_element().access_log_rotate_key_info, "keyinfo" );
+    BOOST_CHECK_EQUAL( vs->get_element().access_log_rotate_verbose_info, "keyinfo" );
+    BOOST_CHECK_EQUAL( vs->get_access_log_file_name(), vs->get_element().access_log_file_name );
+    BOOST_CHECK( vs->get_access_log_rotate_arguments() == elem1.access_log_rotate_arguments );
+
+    boost::thread    vs_main( &l7vs::vs_tcp::run, vs );
+    usleep( 2000000 );
+
+    boost::thread    cl_thread( &client );
+
+    //2秒待ってsessionプールのサイズをチェック
+    usleep( 2000000 );
+    BOOST_CHECK( vs->get_pool_sessions().size() == l7vs::virtualservice_base::SESSION_POOL_NUM_DEFAULT-2 );
+
+    debugg_flug_struct::getInstance().stub_loglevel() = l7vs::LOG_LV_DEBUG;
+    //1秒待ってmainをSTOP
+    usleep( 1000000 );
+    vs->stop();
+
+    usleep( 1000 );
+    cl_thread.join();
+    vs_main.join();
+
+    vs_err.setter(false,"");
+    vs->finalize( vs_err );
+
+    delete vs;
+    }
+
+    //flag=OFF,file=empty,key=""
+    {
+    debugg_flug_struct::getInstance().param_exist_flag() = false;
+    debugg_flug_struct::getInstance().pmcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().smcontrol_err_flag()    = false;
+
+    l7vs::error_code            vs_err;
+    boost::system::error_code   test_err;
+
+    std::stringstream    tmp_tcp_ep;
+    std::stringstream    tmp_udp_ep;
+    std::stringstream    tmp_sorry_ep;
+
+    l7vs::l7vsd                  vsd;
+    boost::asio::io_service      dispatcher;
+    l7vs::replication            rep;
+    l7vs::virtualservice_element elem1;
+
+    elem1.udpmode                = false;
+    elem1.tcp_accept_endpoint    = 
+            tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem1.udp_recv_endpoint      = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem1.realserver_vector.clear();
+    elem1.protocol_module_name   = "PMtest1";
+    elem1.schedule_module_name   = "SMtest1";
+    elem1.protocol_args.clear();
+    elem1.sorry_maxconnection    = 1234LL;
+    elem1.sorry_endpoint         = 
+            tcp_ep_type( boost::asio::ip::address::from_string( "AFAF:0E08::8FDE" ), (8080) );
+    elem1.sorry_flag             = false;
+    elem1.qos_upstream           = 65535ULL;
+    elem1.qos_downstream         = 32767ULL;
+    elem1.ssl_file_name          = "";
+    elem1.access_log_flag        = 0;
+    elem1.access_log_file_name   = "";
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-type" , "size" ) );
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-backup-index" , "1" ) );
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-filesize" , "10M" ) );
+    elem1.access_log_rotate_key_info = "";
+    elem1.access_log_rotate_verbose_info = "dummy";
+
+    //vs作成
+    l7vs::vs_tcp*    vs = new l7vs::vs_tcp( vsd, rep, elem1 );
+    BOOST_CHECK_EQUAL( &vsd, &(vs->get_vsd()) );
+    BOOST_CHECK_EQUAL( &rep, &(vs->get_rep()) );
+    BOOST_CHECK( elem1 == vs->get_element() );
+
+    vs_err.setter(false,"");
+    // unit_test[169] initialize (flag=OFF,file=empty,key="")
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "initialize_test (flag=OFF,file=empty,key=\"\")" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    vs->initialize( vs_err );
+
+    BOOST_CHECK_EQUAL( vs->get_access_log_flag(), false );
+    BOOST_CHECK_EQUAL( vs->get_element().access_log_rotate_key_info, "none" );
+    BOOST_CHECK_EQUAL( vs->get_element().access_log_rotate_verbose_info, "" );
+    BOOST_CHECK_EQUAL( vs->get_access_log_file_name(), vs->get_element().access_log_file_name );
+    BOOST_CHECK( vs->get_access_log_rotate_arguments() == elem1.access_log_rotate_arguments );
+
+    boost::thread    vs_main( &l7vs::vs_tcp::run, vs );
+    usleep( 2000000 );
+
+    boost::thread    cl_thread( &client );
+
+    //2秒待ってsessionプールのサイズをチェック
+    usleep( 2000000 );
+    BOOST_CHECK( vs->get_pool_sessions().size() == l7vs::virtualservice_base::SESSION_POOL_NUM_DEFAULT-2 );
+
+    debugg_flug_struct::getInstance().stub_loglevel() = l7vs::LOG_LV_DEBUG;
+    //1秒待ってmainをSTOP
+    usleep( 1000000 );
+    vs->stop();
+
+    usleep( 1000 );
+    cl_thread.join();
+    vs_main.join();
+
+    vs_err.setter(false,"");
+    vs->finalize( vs_err );
+
+    delete vs;
+    }
+
+    //flag=ON,file=empty,key=""
+    {
+    debugg_flug_struct::getInstance().param_exist_flag() = false;
+    debugg_flug_struct::getInstance().pmcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().smcontrol_err_flag()    = false;
+
+    l7vs::error_code            vs_err;
+    boost::system::error_code   test_err;
+
+    std::stringstream    tmp_tcp_ep;
+    std::stringstream    tmp_udp_ep;
+    std::stringstream    tmp_sorry_ep;
+
+    l7vs::l7vsd                  vsd;
+    boost::asio::io_service      dispatcher;
+    l7vs::replication            rep;
+    l7vs::virtualservice_element elem1;
+
+    elem1.udpmode                = false;
+    elem1.tcp_accept_endpoint    = 
+            tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem1.udp_recv_endpoint      = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem1.realserver_vector.clear();
+    elem1.protocol_module_name   = "PMtest1";
+    elem1.schedule_module_name   = "SMtest1";
+    elem1.protocol_args.clear();
+    elem1.sorry_maxconnection    = 1234LL;
+    elem1.sorry_endpoint         = 
+            tcp_ep_type( boost::asio::ip::address::from_string( "AFAF:0E08::8FDE" ), (8080) );
+    elem1.sorry_flag             = false;
+    elem1.qos_upstream           = 65535ULL;
+    elem1.qos_downstream         = 32767ULL;
+    elem1.ssl_file_name          = "";
+    elem1.access_log_flag        = 1;
+    elem1.access_log_file_name   = "";
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-type" , "size" ) );
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-backup-index" , "1" ) );
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-filesize" , "10M" ) );
+    elem1.access_log_rotate_key_info = "";
+    elem1.access_log_rotate_verbose_info = "dummy";
+
+    //vs作成
+    l7vs::vs_tcp*    vs = new l7vs::vs_tcp( vsd, rep, elem1 );
+    BOOST_CHECK_EQUAL( &vsd, &(vs->get_vsd()) );
+    BOOST_CHECK_EQUAL( &rep, &(vs->get_rep()) );
+    BOOST_CHECK( elem1 == vs->get_element() );
+
+    vs_err.setter(false,"");
+    // unit_test[170] initialize (flag=ON,file=empty,key="")
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "initialize_test (flag=ON,file=empty,key=\"\")" << std::endl;
+    std::cout << "  target:access log file name not set error" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+
+    vs->initialize( vs_err );
+
+    BOOST_CHECK_EQUAL( vs_err, true );
+    BOOST_CHECK_EQUAL( vs_err.get_message(), "access log file name not set error" );
+
+/*
+    boost::thread    vs_main( &l7vs::vs_tcp::run, vs );
+    usleep( 2000000 );
+
+    boost::thread    cl_thread( &client );
+    //2秒待ってsessionプールのサイズをチェック
+    usleep( 2000000 );
+    BOOST_CHECK( vs->get_pool_sessions().size() == l7vs::virtualservice_base::SESSION_POOL_NUM_DEFAULT-2 );
+
+    debugg_flug_struct::getInstance().stub_loglevel() = l7vs::LOG_LV_DEBUG;
+    //1秒待ってmainをSTOP
+    usleep( 1000000 );
+    vs->stop();
+
+    usleep( 1000 );
+    cl_thread.join();
+    vs_main.join();
+*/
+    vs_err.setter(false,"");
+    vs->finalize( vs_err );
+
+    delete vs;
+    }
+
+    //flag=ON,file=not empty,access_log_instance NG
+    {
+    debugg_flug_struct::getInstance().param_exist_flag() = false;
+    debugg_flug_struct::getInstance().pmcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().smcontrol_err_flag()    = false;
+
+    l7vs::error_code            vs_err;
+    boost::system::error_code   test_err;
+
+    std::stringstream    tmp_tcp_ep;
+    std::stringstream    tmp_udp_ep;
+    std::stringstream    tmp_sorry_ep;
+
+    l7vs::l7vsd                  vsd;
+    boost::asio::io_service      dispatcher;
+    l7vs::replication            rep;
+    l7vs::virtualservice_element elem1;
+
+    elem1.udpmode                = false;
+    elem1.tcp_accept_endpoint    = 
+            tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem1.udp_recv_endpoint      = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem1.realserver_vector.clear();
+    elem1.protocol_module_name   = "PMtest1";
+    elem1.schedule_module_name   = "SMtest1";
+    elem1.protocol_args.clear();
+    elem1.sorry_maxconnection    = 1234LL;
+    elem1.sorry_endpoint         = 
+            tcp_ep_type( boost::asio::ip::address::from_string( "AFAF:0E08::8FDE" ), (8080) );
+    elem1.sorry_flag             = false;
+    elem1.qos_upstream           = 65535ULL;
+    elem1.qos_downstream         = 32767ULL;
+    elem1.ssl_file_name          = "";
+    elem1.access_log_flag        = 1;
+    elem1.access_log_file_name   = "access_log.log";
+//    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-type" , "size" ) );
+//    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-backup-index" , "1" ) );
+//    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-filesize" , "10M" ) );
+    elem1.access_log_rotate_key_info = "";
+    elem1.access_log_rotate_verbose_info = "dummy";
+
+    //vs作成
+    l7vs::vs_tcp*    vs = new l7vs::vs_tcp( vsd, rep, elem1 );
+    BOOST_CHECK_EQUAL( &vsd, &(vs->get_vsd()) );
+    BOOST_CHECK_EQUAL( &rep, &(vs->get_rep()) );
+    BOOST_CHECK( elem1 == vs->get_element() );
+
+    vs_err.setter(false,"");
+    // unit_test[171] initialize (flag=ON,file=not empty,access_log_instance NG)
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "initialize_test (flag=ON,file=not empty,access_log_instance NG)" << std::endl;
+    std::cout << "  target:access logger Instance acquisition" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    vs->initialize( vs_err );
+
+    BOOST_CHECK_EQUAL( vs_err, true );
+    BOOST_CHECK_EQUAL( vs_err.get_message(), "access log class instance create failed" );
+
+/*
+    boost::thread    vs_main( &l7vs::vs_tcp::run, vs );
+    usleep( 2000000 );
+
+    boost::thread    cl_thread( &client );
+
+    //2秒待ってsessionプールのサイズをチェック
+    usleep( 2000000 );
+    BOOST_CHECK( vs->get_pool_sessions().size() == l7vs::virtualservice_base::SESSION_POOL_NUM_DEFAULT-2 );
+
+    debugg_flug_struct::getInstance().stub_loglevel() = l7vs::LOG_LV_DEBUG;
+    //1秒待ってmainをSTOP
+    usleep( 1000000 );
+    vs->stop();
+
+    usleep( 1000 );
+    cl_thread.join();
+    vs_main.join();
+*/
+    vs_err.setter(false,"");
+    vs->finalize( vs_err );
+
+    delete vs;
+    }
+
+}
+
+// l7vs::virtualservice_tcp::finalize test
+void    virtualservice_tcp_finalize_test(){
+
+    // erase_logger_implement_access OK
+    {
+    debugg_flug_struct::getInstance().param_exist_flag() = false;
+    debugg_flug_struct::getInstance().pmcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().smcontrol_err_flag()    = false;
+
+    l7vs::error_code            vs_err;
+    boost::system::error_code   test_err;
+
+    std::stringstream    tmp_tcp_ep;
+    std::stringstream    tmp_udp_ep;
+    std::stringstream    tmp_sorry_ep;
+
+    l7vs::l7vsd                  vsd;
+    boost::asio::io_service      dispatcher;
+    l7vs::replication            rep;
+    l7vs::virtualservice_element elem1;
+
+    elem1.udpmode                = false;
+    elem1.tcp_accept_endpoint    = 
+            tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem1.udp_recv_endpoint      = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem1.realserver_vector.clear();
+    elem1.protocol_module_name   = "PMtest1";
+    elem1.schedule_module_name   = "SMtest1";
+    elem1.protocol_args.clear();
+    elem1.sorry_maxconnection    = 1234LL;
+    elem1.sorry_endpoint         = 
+            tcp_ep_type( boost::asio::ip::address::from_string( "AFAF:0E08::8FDE" ), (8080) );
+    elem1.sorry_flag             = false;
+    elem1.qos_upstream           = 65535ULL;
+    elem1.qos_downstream         = 32767ULL;
+    elem1.ssl_file_name          = "";
+    elem1.access_log_flag        = 1;
+    elem1.access_log_file_name   = "access_log.log";
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-type" , "size" ) );
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-backup-index" , "1" ) );
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-filesize" , "10M" ) );
+    elem1.access_log_rotate_key_info = "";
+    elem1.access_log_rotate_verbose_info = "dummy";
+
+    //vs作成
+    l7vs::vs_tcp*    vs = new l7vs::vs_tcp( vsd, rep, elem1 );
+    BOOST_CHECK_EQUAL( &vsd, &(vs->get_vsd()) );
+    BOOST_CHECK_EQUAL( &rep, &(vs->get_rep()) );
+    BOOST_CHECK( elem1 == vs->get_element() );
+
+    vs_err.setter(false,"");
+    vs->initialize( vs_err );
+
+    BOOST_CHECK_EQUAL( vs->get_access_log_flag(), true );
+    BOOST_CHECK_EQUAL( vs->get_element().access_log_rotate_key_info, "none" );
+    BOOST_CHECK_EQUAL( vs->get_element().access_log_rotate_verbose_info, "" );
+    BOOST_CHECK_EQUAL( vs->get_access_log_file_name(), vs->get_element().access_log_file_name );
+    BOOST_CHECK( vs->get_access_log_rotate_arguments() == elem1.access_log_rotate_arguments );
+
+    boost::thread    vs_main( &l7vs::vs_tcp::run, vs );
+    usleep( 2000000 );
+
+    boost::thread    cl_thread( &client );
+
+    //2秒待ってsessionプールのサイズをチェック
+    usleep( 2000000 );
+    BOOST_CHECK( vs->get_pool_sessions().size() == l7vs::virtualservice_base::SESSION_POOL_NUM_DEFAULT-2 );
+
+    debugg_flug_struct::getInstance().stub_loglevel() = l7vs::LOG_LV_DEBUG;
+    //1秒待ってmainをSTOP
+    usleep( 1000000 );
+    vs->stop();
+
+    usleep( 1000 );
+    cl_thread.join();
+    vs_main.join();
+
+    // unit_test[172] finalize (erase_logger_implement_access OK)
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "finalize_test (erase_logger_implement_access OK)" << std::endl;
+    std::cout << "NOT OUTPUT LOG access logger instance erase err" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    // NOT OUTPUT LOG access logger instance erase err
+    vs_err.setter(false,"");
+    vs->finalize( vs_err );
+
+    delete vs;
+    }
+
+    // erase_logger_implement_access NG
+    {
+    debugg_flug_struct::getInstance().param_exist_flag() = false;
+    debugg_flug_struct::getInstance().pmcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().smcontrol_err_flag()    = false;
+
+    l7vs::error_code            vs_err;
+    boost::system::error_code   test_err;
+
+    std::stringstream    tmp_tcp_ep;
+    std::stringstream    tmp_udp_ep;
+    std::stringstream    tmp_sorry_ep;
+
+    l7vs::l7vsd                  vsd;
+    boost::asio::io_service      dispatcher;
+    l7vs::replication            rep;
+    l7vs::virtualservice_element elem1;
+
+    elem1.udpmode                = false;
+    elem1.tcp_accept_endpoint    = 
+            tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem1.udp_recv_endpoint      = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem1.realserver_vector.clear();
+    elem1.protocol_module_name   = "PMtest1";
+    elem1.schedule_module_name   = "SMtest1";
+    elem1.protocol_args.clear();
+    elem1.sorry_maxconnection    = 1234LL;
+    elem1.sorry_endpoint         = 
+            tcp_ep_type( boost::asio::ip::address::from_string( "AFAF:0E08::8FDE" ), (8080) );
+    elem1.sorry_flag             = false;
+    elem1.qos_upstream           = 65535ULL;
+    elem1.qos_downstream         = 32767ULL;
+    elem1.ssl_file_name          = "";
+    elem1.access_log_flag        = 1;
+    elem1.access_log_file_name   = "access_log.log";
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-type" , "size" ) );
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-backup-index" , "1" ) );
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-filesize" , "10M" ) );
+    elem1.access_log_rotate_key_info = "";
+    elem1.access_log_rotate_verbose_info = "dummy";
+
+    //vs作成
+    l7vs::vs_tcp*    vs = new l7vs::vs_tcp( vsd, rep, elem1 );
+    BOOST_CHECK_EQUAL( &vsd, &(vs->get_vsd()) );
+    BOOST_CHECK_EQUAL( &rep, &(vs->get_rep()) );
+    BOOST_CHECK( elem1 == vs->get_element() );
+
+    vs_err.setter(false,"");
+    vs->initialize( vs_err );
+
+    BOOST_CHECK_EQUAL( vs->get_access_log_flag(), true );
+    BOOST_CHECK_EQUAL( vs->get_element().access_log_rotate_key_info, "none" );
+    BOOST_CHECK_EQUAL( vs->get_element().access_log_rotate_verbose_info, "" );
+    BOOST_CHECK_EQUAL( vs->get_access_log_file_name(), vs->get_element().access_log_file_name );
+    BOOST_CHECK( vs->get_access_log_rotate_arguments() == elem1.access_log_rotate_arguments );
+
+    boost::thread    vs_main( &l7vs::vs_tcp::run, vs );
+    usleep( 2000000 );
+
+    boost::thread    cl_thread( &client );
+
+    //2秒待ってsessionプールのサイズをチェック
+    usleep( 2000000 );
+    BOOST_CHECK( vs->get_pool_sessions().size() == l7vs::virtualservice_base::SESSION_POOL_NUM_DEFAULT-2 );
+
+    debugg_flug_struct::getInstance().stub_loglevel() = l7vs::LOG_LV_DEBUG;
+    //1秒待ってmainをSTOP
+    usleep( 1000000 );
+    vs->stop();
+
+    usleep( 1000 );
+    cl_thread.join();
+    vs_main.join();
+
+    // unit_test[173] finalize (erase_logger_implement_access NG)
+    vs->set_access_log_file_name("hoge.log");
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "finalize_test (erase_logger_implement_access NG)" << std::endl;
+    std::cout << "OUTPUT LOG access logger instance erase err" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    // OUTPUT LOG access logger instance erase err
+    vs_err.setter(false,"");
+    vs->finalize( vs_err );
+
+    delete vs;
+    }
+
+}
+
+
+// edit_virtualservice test
+void    virtualservice_tcp_edit_virtualservice_test(){
+
+    // edit(flag:OFF,filename:not empty)->(flag:ON)
+    {
+    debugg_flug_struct::getInstance().param_exist_flag() = false;
+    debugg_flug_struct::getInstance().pmcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().smcontrol_err_flag()    = false;
+
+    l7vs::error_code            vs_err;
+    boost::system::error_code   test_err;
+
+    std::stringstream    tmp_tcp_ep;
+    std::stringstream    tmp_udp_ep;
+    std::stringstream    tmp_sorry_ep;
+
+    l7vs::l7vsd                  vsd;
+    boost::asio::io_service      dispatcher;
+    l7vs::replication            rep;
+    l7vs::virtualservice_element elem1;
+
+    elem1.udpmode                = false;
+    elem1.tcp_accept_endpoint    = 
+            tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem1.udp_recv_endpoint      = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem1.realserver_vector.clear();
+    elem1.protocol_module_name   = "PMtest1";
+    elem1.schedule_module_name   = "SMtest1";
+    elem1.protocol_args.clear();
+    elem1.sorry_maxconnection    = 1234LL;
+    elem1.sorry_endpoint         = 
+            tcp_ep_type( boost::asio::ip::address::from_string( "AFAF:0E08::8FDE" ), (8080) );
+    elem1.sorry_flag             = false;
+    elem1.qos_upstream           = 65535ULL;
+    elem1.qos_downstream         = 32767ULL;
+    elem1.ssl_file_name          = "";
+    elem1.access_log_flag        = 0;
+    elem1.access_log_file_name   = "access_log.log";
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-type" , "size" ) );
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-backup-index" , "1" ) );
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-filesize" , "10M" ) );
+    elem1.access_log_rotate_key_info = "";
+    elem1.access_log_rotate_verbose_info = "dummy";
+
+    //vs作成
+    l7vs::vs_tcp*    vs = new l7vs::vs_tcp( vsd, rep, elem1 );
+    BOOST_CHECK_EQUAL( &vsd, &(vs->get_vsd()) );
+    BOOST_CHECK_EQUAL( &rep, &(vs->get_rep()) );
+    BOOST_CHECK( elem1 == vs->get_element() );
+
+    vs_err.setter(false,"");
+    vs->initialize( vs_err );
+
+    BOOST_CHECK_EQUAL( vs->get_access_log_flag(), false );
+    BOOST_CHECK_EQUAL( vs->get_element().access_log_rotate_key_info, "none" );
+    BOOST_CHECK_EQUAL( vs->get_element().access_log_rotate_verbose_info, "" );
+    BOOST_CHECK_EQUAL( vs->get_access_log_file_name(), vs->get_element().access_log_file_name );
+    BOOST_CHECK( vs->get_access_log_rotate_arguments() == elem1.access_log_rotate_arguments );
+
+    boost::thread    vs_main( &l7vs::vs_tcp::run, vs );
+    usleep( 2000000 );
+
+    boost::thread    cl_thread( &client );
+
+    //2秒待ってsessionプールのサイズをチェック
+    usleep( 2000000 );
+    BOOST_CHECK( vs->get_pool_sessions().size() == l7vs::virtualservice_base::SESSION_POOL_NUM_DEFAULT-2 );
+
+    debugg_flug_struct::getInstance().stub_loglevel() = l7vs::LOG_LV_DEBUG;
+
+    usleep( 1000000 );
+
+    // create edit element
+    l7vs::virtualservice_element elem2;
+
+    elem2.udpmode                = false;
+    elem2.tcp_accept_endpoint    = 
+            tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem2.udp_recv_endpoint      = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem2.realserver_vector.clear();
+    elem2.protocol_module_name   = "PMtest1";
+    elem2.schedule_module_name   = "SMtest1";
+    elem2.protocol_args.clear();
+    elem2.sorry_maxconnection    = 1234LL;
+    elem2.sorry_endpoint         = 
+            tcp_ep_type( boost::asio::ip::address::from_string( "AFAF:0E08::8FDE" ), (8080) );
+    elem2.sorry_flag             = false;
+    elem2.qos_upstream           = 65535ULL;
+    elem2.qos_downstream         = 32767ULL;
+    elem2.ssl_file_name          = "";
+    elem2.access_log_flag        = 1;
+//    elem2.access_log_file_name   = "access_log.log";
+//    elem2.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-type" , "size" ) );
+//    elem2.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-backup-index" , "1" ) );
+//    elem2.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-filesize" , "10M" ) );
+//    elem2.access_log_rotate_key_info = "";
+//    elem2.access_log_rotate_verbose_info = "dummy";
+
+    // unit_test[174] edit(flag:OFF,filename:not empty)->(flag:ON)
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "edit_virtualservice_test" << std::endl;
+    std::cout << "(flag:OFF,filename:not empty)->(flag:ON)" << std::endl;
+    std::cout << "  target:set_virtual_service_message called : ACCESS_LOG_ON" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+    // set_virtual_service_message called : ACCESS_LOG_ON
+    vs_err.setter(false,"");
+    vs->edit_virtualservice( elem2, vs_err );
+
+    BOOST_CHECK_EQUAL( vs_err, false );
+    BOOST_CHECK_EQUAL( vs->get_access_log_flag(), true );
+    BOOST_CHECK_EQUAL( vs->get_element().access_log_rotate_key_info, "none" );
+    BOOST_CHECK_EQUAL( vs->get_element().access_log_rotate_verbose_info, "" );
+    BOOST_CHECK_EQUAL( vs->get_access_log_file_name(), vs->get_element().access_log_file_name );
+    BOOST_CHECK( vs->get_access_log_rotate_arguments() == elem1.access_log_rotate_arguments );
+
+    vs->stop();
+
+    usleep( 1000 );
+    cl_thread.join();
+    vs_main.join();
+
+    vs_err.setter(false,"");
+    vs->finalize( vs_err );
+
+    delete vs;
+    }
+
+    // edit(flag:ON,filename:not empty)->(flag:ON)
+    {
+    debugg_flug_struct::getInstance().param_exist_flag() = false;
+    debugg_flug_struct::getInstance().pmcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().smcontrol_err_flag()    = false;
+
+    l7vs::error_code            vs_err;
+    boost::system::error_code   test_err;
+
+    std::stringstream    tmp_tcp_ep;
+    std::stringstream    tmp_udp_ep;
+    std::stringstream    tmp_sorry_ep;
+
+    l7vs::l7vsd                  vsd;
+    boost::asio::io_service      dispatcher;
+    l7vs::replication            rep;
+    l7vs::virtualservice_element elem1;
+
+    elem1.udpmode                = false;
+    elem1.tcp_accept_endpoint    = 
+            tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem1.udp_recv_endpoint      = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem1.realserver_vector.clear();
+    elem1.protocol_module_name   = "PMtest1";
+    elem1.schedule_module_name   = "SMtest1";
+    elem1.protocol_args.clear();
+    elem1.sorry_maxconnection    = 1234LL;
+    elem1.sorry_endpoint         = 
+            tcp_ep_type( boost::asio::ip::address::from_string( "AFAF:0E08::8FDE" ), (8080) );
+    elem1.sorry_flag             = false;
+    elem1.qos_upstream           = 65535ULL;
+    elem1.qos_downstream         = 32767ULL;
+    elem1.ssl_file_name          = "";
+    elem1.access_log_flag        = 1;
+    elem1.access_log_file_name   = "access_log.log";
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-type" , "size" ) );
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-backup-index" , "1" ) );
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-filesize" , "10M" ) );
+    elem1.access_log_rotate_key_info = "";
+    elem1.access_log_rotate_verbose_info = "dummy";
+
+    //vs作成
+    l7vs::vs_tcp*    vs = new l7vs::vs_tcp( vsd, rep, elem1 );
+    BOOST_CHECK_EQUAL( &vsd, &(vs->get_vsd()) );
+    BOOST_CHECK_EQUAL( &rep, &(vs->get_rep()) );
+    BOOST_CHECK( elem1 == vs->get_element() );
+
+    vs_err.setter(false,"");
+    vs->initialize( vs_err );
+
+    BOOST_CHECK_EQUAL( vs->get_access_log_flag(), true );
+    BOOST_CHECK_EQUAL( vs->get_element().access_log_rotate_key_info, "none" );
+    BOOST_CHECK_EQUAL( vs->get_element().access_log_rotate_verbose_info, "" );
+    BOOST_CHECK_EQUAL( vs->get_access_log_file_name(), vs->get_element().access_log_file_name );
+    BOOST_CHECK( vs->get_access_log_rotate_arguments() == elem1.access_log_rotate_arguments );
+
+    boost::thread    vs_main( &l7vs::vs_tcp::run, vs );
+    usleep( 2000000 );
+
+    boost::thread    cl_thread( &client );
+
+    //2秒待ってsessionプールのサイズをチェック
+    usleep( 2000000 );
+    BOOST_CHECK( vs->get_pool_sessions().size() == l7vs::virtualservice_base::SESSION_POOL_NUM_DEFAULT-2 );
+
+    debugg_flug_struct::getInstance().stub_loglevel() = l7vs::LOG_LV_DEBUG;
+
+    usleep( 1000000 );
+
+    // create edit element
+    l7vs::virtualservice_element elem2;
+
+    elem2.udpmode                = false;
+    elem2.tcp_accept_endpoint    = 
+            tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem2.udp_recv_endpoint      = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem2.realserver_vector.clear();
+    elem2.protocol_module_name   = "PMtest1";
+    elem2.schedule_module_name   = "SMtest1";
+    elem2.protocol_args.clear();
+    elem2.sorry_maxconnection    = 1234LL;
+    elem2.sorry_endpoint         = 
+            tcp_ep_type( boost::asio::ip::address::from_string( "AFAF:0E08::8FDE" ), (8080) );
+    elem2.sorry_flag             = false;
+    elem2.qos_upstream           = 65535ULL;
+    elem2.qos_downstream         = 32767ULL;
+    elem2.ssl_file_name          = "";
+    elem2.access_log_flag        = 1;
+//    elem2.access_log_file_name   = "access_log.log";
+//    elem2.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-type" , "size" ) );
+//    elem2.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-backup-index" , "1" ) );
+//    elem2.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-filesize" , "10M" ) );
+//    elem2.access_log_rotate_key_info = "";
+//    elem2.access_log_rotate_verbose_info = "dummy";
+
+    // unit_test[175] edit(flag:ON,filename:not empty)->(flag:ON)
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "edit_virtualservice_test" << std::endl;
+    std::cout << "(flag:ON,filename:not empty)->(flag:ON)" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+
+    vs_err.setter(false,"");
+    vs->edit_virtualservice( elem2, vs_err );
+
+    BOOST_CHECK_EQUAL( vs_err, false );
+    BOOST_CHECK_EQUAL( vs->get_access_log_flag(), true );
+    BOOST_CHECK_EQUAL( vs->get_element().access_log_rotate_key_info, "none" );
+    BOOST_CHECK_EQUAL( vs->get_element().access_log_rotate_verbose_info, "" );
+    BOOST_CHECK_EQUAL( vs->get_access_log_file_name(), vs->get_element().access_log_file_name );
+    BOOST_CHECK( vs->get_access_log_rotate_arguments() == elem1.access_log_rotate_arguments );
+
+    vs->stop();
+
+    usleep( 1000 );
+    cl_thread.join();
+    vs_main.join();
+
+    vs_err.setter(false,"");
+    vs->finalize( vs_err );
+
+    delete vs;
+    }
+
+    // edit(flag:ON,filename:not empty)->(flag:OFF)
+    {
+    debugg_flug_struct::getInstance().param_exist_flag() = false;
+    debugg_flug_struct::getInstance().pmcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().smcontrol_err_flag()    = false;
+
+    l7vs::error_code            vs_err;
+    boost::system::error_code   test_err;
+
+    std::stringstream    tmp_tcp_ep;
+    std::stringstream    tmp_udp_ep;
+    std::stringstream    tmp_sorry_ep;
+
+    l7vs::l7vsd                  vsd;
+    boost::asio::io_service      dispatcher;
+    l7vs::replication            rep;
+    l7vs::virtualservice_element elem1;
+
+    elem1.udpmode                = false;
+    elem1.tcp_accept_endpoint    = 
+            tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem1.udp_recv_endpoint      = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem1.realserver_vector.clear();
+    elem1.protocol_module_name   = "PMtest1";
+    elem1.schedule_module_name   = "SMtest1";
+    elem1.protocol_args.clear();
+    elem1.sorry_maxconnection    = 1234LL;
+    elem1.sorry_endpoint         = 
+            tcp_ep_type( boost::asio::ip::address::from_string( "AFAF:0E08::8FDE" ), (8080) );
+    elem1.sorry_flag             = false;
+    elem1.qos_upstream           = 65535ULL;
+    elem1.qos_downstream         = 32767ULL;
+    elem1.ssl_file_name          = "";
+    elem1.access_log_flag        = 1;
+    elem1.access_log_file_name   = "access_log.log";
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-type" , "size" ) );
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-backup-index" , "1" ) );
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-filesize" , "10M" ) );
+    elem1.access_log_rotate_key_info = "";
+    elem1.access_log_rotate_verbose_info = "dummy";
+
+    //vs作成
+    l7vs::vs_tcp*    vs = new l7vs::vs_tcp( vsd, rep, elem1 );
+    BOOST_CHECK_EQUAL( &vsd, &(vs->get_vsd()) );
+    BOOST_CHECK_EQUAL( &rep, &(vs->get_rep()) );
+    BOOST_CHECK( elem1 == vs->get_element() );
+
+    vs_err.setter(false,"");
+    vs->initialize( vs_err );
+
+    BOOST_CHECK_EQUAL( vs->get_access_log_flag(), true );
+    BOOST_CHECK_EQUAL( vs->get_element().access_log_rotate_key_info, "none" );
+    BOOST_CHECK_EQUAL( vs->get_element().access_log_rotate_verbose_info, "" );
+    BOOST_CHECK_EQUAL( vs->get_access_log_file_name(), vs->get_element().access_log_file_name );
+    BOOST_CHECK( vs->get_access_log_rotate_arguments() == elem1.access_log_rotate_arguments );
+
+    boost::thread    vs_main( &l7vs::vs_tcp::run, vs );
+    usleep( 2000000 );
+
+    boost::thread    cl_thread( &client );
+
+    //2秒待ってsessionプールのサイズをチェック
+    usleep( 2000000 );
+    BOOST_CHECK( vs->get_pool_sessions().size() == l7vs::virtualservice_base::SESSION_POOL_NUM_DEFAULT-2 );
+
+    debugg_flug_struct::getInstance().stub_loglevel() = l7vs::LOG_LV_DEBUG;
+
+    usleep( 1000000 );
+
+    // create edit element
+    l7vs::virtualservice_element elem2;
+
+    elem2.udpmode                = false;
+    elem2.tcp_accept_endpoint    = 
+            tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem2.udp_recv_endpoint      = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem2.realserver_vector.clear();
+    elem2.protocol_module_name   = "PMtest1";
+    elem2.schedule_module_name   = "SMtest1";
+    elem2.protocol_args.clear();
+    elem2.sorry_maxconnection    = 1234LL;
+    elem2.sorry_endpoint         = 
+            tcp_ep_type( boost::asio::ip::address::from_string( "AFAF:0E08::8FDE" ), (8080) );
+    elem2.sorry_flag             = false;
+    elem2.qos_upstream           = 65535ULL;
+    elem2.qos_downstream         = 32767ULL;
+    elem2.ssl_file_name          = "";
+    elem2.access_log_flag        = 0;
+//    elem2.access_log_file_name   = "access_log.log";
+//    elem2.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-type" , "size" ) );
+//    elem2.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-backup-index" , "1" ) );
+//    elem2.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-filesize" , "10M" ) );
+//    elem2.access_log_rotate_key_info = "";
+//    elem2.access_log_rotate_verbose_info = "dummy";
+
+    // unit_test[176] edit(flag:ON,filename:not empty)->(flag:OFF)
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "edit_virtualservice_test" << std::endl;
+    std::cout << "(flag:ON,filename:not empty)->(flag:OFF)" << std::endl;
+    std::cout << "NOT OUTPUT LOG :set_virtual_service_message called : ACCESS_LOG_OFF" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+
+    vs_err.setter(false,"");
+    vs->edit_virtualservice( elem2, vs_err );
+
+    BOOST_CHECK_EQUAL( vs_err, false );
+    BOOST_CHECK_EQUAL( vs->get_access_log_flag(), false );
+    BOOST_CHECK_EQUAL( vs->get_element().access_log_rotate_key_info, "none" );
+    BOOST_CHECK_EQUAL( vs->get_element().access_log_rotate_verbose_info, "" );
+    BOOST_CHECK_EQUAL( vs->get_access_log_file_name(), vs->get_element().access_log_file_name );
+    BOOST_CHECK( vs->get_access_log_rotate_arguments() == elem1.access_log_rotate_arguments );
+
+    vs->stop();
+
+    usleep( 1000 );
+    cl_thread.join();
+    vs_main.join();
+
+    vs_err.setter(false,"");
+    vs->finalize( vs_err );
+
+    delete vs;
+    }
+
+    // edit(flag:OFF,filename:empty)->(flag:OFF)
+    {
+    debugg_flug_struct::getInstance().param_exist_flag() = false;
+    debugg_flug_struct::getInstance().pmcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().smcontrol_err_flag()    = false;
+
+    l7vs::error_code            vs_err;
+    boost::system::error_code   test_err;
+
+    std::stringstream    tmp_tcp_ep;
+    std::stringstream    tmp_udp_ep;
+    std::stringstream    tmp_sorry_ep;
+
+    l7vs::l7vsd                  vsd;
+    boost::asio::io_service      dispatcher;
+    l7vs::replication            rep;
+    l7vs::virtualservice_element elem1;
+
+    elem1.udpmode                = false;
+    elem1.tcp_accept_endpoint    = 
+            tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem1.udp_recv_endpoint      = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem1.realserver_vector.clear();
+    elem1.protocol_module_name   = "PMtest1";
+    elem1.schedule_module_name   = "SMtest1";
+    elem1.protocol_args.clear();
+    elem1.sorry_maxconnection    = 1234LL;
+    elem1.sorry_endpoint         = 
+            tcp_ep_type( boost::asio::ip::address::from_string( "AFAF:0E08::8FDE" ), (8080) );
+    elem1.sorry_flag             = false;
+    elem1.qos_upstream           = 65535ULL;
+    elem1.qos_downstream         = 32767ULL;
+    elem1.ssl_file_name          = "";
+    elem1.access_log_flag        = 0;
+    elem1.access_log_file_name   = "";
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-type" , "size" ) );
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-backup-index" , "1" ) );
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-filesize" , "10M" ) );
+    elem1.access_log_rotate_key_info = "";
+    elem1.access_log_rotate_verbose_info = "dummy";
+
+    //vs作成
+    l7vs::vs_tcp*    vs = new l7vs::vs_tcp( vsd, rep, elem1 );
+    BOOST_CHECK_EQUAL( &vsd, &(vs->get_vsd()) );
+    BOOST_CHECK_EQUAL( &rep, &(vs->get_rep()) );
+    BOOST_CHECK( elem1 == vs->get_element() );
+
+    vs_err.setter(false,"");
+    vs->initialize( vs_err );
+
+    BOOST_CHECK_EQUAL( vs->get_access_log_flag(), false );
+    BOOST_CHECK_EQUAL( vs->get_element().access_log_rotate_key_info, "none" );
+    BOOST_CHECK_EQUAL( vs->get_element().access_log_rotate_verbose_info, "" );
+    BOOST_CHECK_EQUAL( vs->get_access_log_file_name(), vs->get_element().access_log_file_name );
+    BOOST_CHECK( vs->get_access_log_rotate_arguments() == elem1.access_log_rotate_arguments );
+
+    boost::thread    vs_main( &l7vs::vs_tcp::run, vs );
+    usleep( 2000000 );
+
+    boost::thread    cl_thread( &client );
+
+    //2秒待ってsessionプールのサイズをチェック
+    usleep( 2000000 );
+    BOOST_CHECK( vs->get_pool_sessions().size() == l7vs::virtualservice_base::SESSION_POOL_NUM_DEFAULT-2 );
+
+    debugg_flug_struct::getInstance().stub_loglevel() = l7vs::LOG_LV_DEBUG;
+
+    usleep( 1000000 );
+
+    // create edit element
+    l7vs::virtualservice_element elem2;
+
+    elem2.udpmode                = false;
+    elem2.tcp_accept_endpoint    = 
+            tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem2.udp_recv_endpoint      = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem2.realserver_vector.clear();
+    elem2.protocol_module_name   = "PMtest1";
+    elem2.schedule_module_name   = "SMtest1";
+    elem2.protocol_args.clear();
+    elem2.sorry_maxconnection    = 1234LL;
+    elem2.sorry_endpoint         = 
+            tcp_ep_type( boost::asio::ip::address::from_string( "AFAF:0E08::8FDE" ), (8080) );
+    elem2.sorry_flag             = false;
+    elem2.qos_upstream           = 65535ULL;
+    elem2.qos_downstream         = 32767ULL;
+    elem2.ssl_file_name          = "";
+    elem2.access_log_flag        = 0;
+//    elem2.access_log_file_name   = "access_log.log";
+//    elem2.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-type" , "size" ) );
+//    elem2.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-backup-index" , "1" ) );
+//    elem2.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-filesize" , "10M" ) );
+//    elem2.access_log_rotate_key_info = "";
+//    elem2.access_log_rotate_verbose_info = "dummy";
+
+    // unit_test[177] edit(flag:ON,filename:empty)->(flag:OFF)
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "edit_virtualservice_test" << std::endl;
+    std::cout << "(flag:ON,filename:empty)->(flag:OFF)" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+
+    vs_err.setter(false,"");
+    vs->edit_virtualservice( elem2, vs_err );
+
+    BOOST_CHECK_EQUAL( vs_err, false );
+    BOOST_CHECK_EQUAL( vs->get_access_log_flag(), false );
+    BOOST_CHECK_EQUAL( vs->get_element().access_log_rotate_key_info, "none" );
+    BOOST_CHECK_EQUAL( vs->get_element().access_log_rotate_verbose_info, "" );
+    BOOST_CHECK_EQUAL( vs->get_access_log_file_name(), vs->get_element().access_log_file_name );
+    BOOST_CHECK( vs->get_access_log_rotate_arguments() == elem1.access_log_rotate_arguments );
+
+    vs->stop();
+
+    usleep( 1000 );
+    cl_thread.join();
+    vs_main.join();
+
+    vs_err.setter(false,"");
+    vs->finalize( vs_err );
+
+    delete vs;
+    }
+
+    // edit(flag:OFF,filename:empty)->(flag:ON) NG
+    {
+    debugg_flug_struct::getInstance().param_exist_flag() = false;
+    debugg_flug_struct::getInstance().pmcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().smcontrol_err_flag()    = false;
+
+    l7vs::error_code            vs_err;
+    boost::system::error_code   test_err;
+
+    std::stringstream    tmp_tcp_ep;
+    std::stringstream    tmp_udp_ep;
+    std::stringstream    tmp_sorry_ep;
+
+    l7vs::l7vsd                  vsd;
+    boost::asio::io_service      dispatcher;
+    l7vs::replication            rep;
+    l7vs::virtualservice_element elem1;
+
+    elem1.udpmode                = false;
+    elem1.tcp_accept_endpoint    = 
+            tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem1.udp_recv_endpoint      = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem1.realserver_vector.clear();
+    elem1.protocol_module_name   = "PMtest1";
+    elem1.schedule_module_name   = "SMtest1";
+    elem1.protocol_args.clear();
+    elem1.sorry_maxconnection    = 1234LL;
+    elem1.sorry_endpoint         = 
+            tcp_ep_type( boost::asio::ip::address::from_string( "AFAF:0E08::8FDE" ), (8080) );
+    elem1.sorry_flag             = false;
+    elem1.qos_upstream           = 65535ULL;
+    elem1.qos_downstream         = 32767ULL;
+    elem1.ssl_file_name          = "";
+    elem1.access_log_flag        = 0;
+    elem1.access_log_file_name   = "";
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-type" , "size" ) );
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-backup-index" , "1" ) );
+    elem1.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-filesize" , "10M" ) );
+    elem1.access_log_rotate_key_info = "";
+    elem1.access_log_rotate_verbose_info = "dummy";
+
+    //vs作成
+    l7vs::vs_tcp*    vs = new l7vs::vs_tcp( vsd, rep, elem1 );
+    BOOST_CHECK_EQUAL( &vsd, &(vs->get_vsd()) );
+    BOOST_CHECK_EQUAL( &rep, &(vs->get_rep()) );
+    BOOST_CHECK( elem1 == vs->get_element() );
+
+    vs_err.setter(false,"");
+    vs->initialize( vs_err );
+
+    BOOST_CHECK_EQUAL( vs->get_access_log_flag(), false );
+    BOOST_CHECK_EQUAL( vs->get_element().access_log_rotate_key_info, "none" );
+    BOOST_CHECK_EQUAL( vs->get_element().access_log_rotate_verbose_info, "" );
+    BOOST_CHECK_EQUAL( vs->get_access_log_file_name(), vs->get_element().access_log_file_name );
+    BOOST_CHECK( vs->get_access_log_rotate_arguments() == elem1.access_log_rotate_arguments );
+
+    boost::thread    vs_main( &l7vs::vs_tcp::run, vs );
+    usleep( 2000000 );
+
+    boost::thread    cl_thread( &client );
+
+    //2秒待ってsessionプールのサイズをチェック
+    usleep( 2000000 );
+    BOOST_CHECK( vs->get_pool_sessions().size() == l7vs::virtualservice_base::SESSION_POOL_NUM_DEFAULT-2 );
+
+    debugg_flug_struct::getInstance().stub_loglevel() = l7vs::LOG_LV_DEBUG;
+
+    usleep( 1000000 );
+
+    // create edit element
+    l7vs::virtualservice_element elem2;
+
+    elem2.udpmode                = false;
+    elem2.tcp_accept_endpoint    = 
+            tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem2.udp_recv_endpoint      = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem2.realserver_vector.clear();
+    elem2.protocol_module_name   = "PMtest1";
+    elem2.schedule_module_name   = "SMtest1";
+    elem2.protocol_args.clear();
+    elem2.sorry_maxconnection    = 1234LL;
+    elem2.sorry_endpoint         = 
+            tcp_ep_type( boost::asio::ip::address::from_string( "AFAF:0E08::8FDE" ), (8080) );
+    elem2.sorry_flag             = false;
+    elem2.qos_upstream           = 65535ULL;
+    elem2.qos_downstream         = 32767ULL;
+    elem2.ssl_file_name          = "";
+    elem2.access_log_flag        = 1;
+//    elem2.access_log_file_name   = "access_log.log";
+//    elem2.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-type" , "size" ) );
+//    elem2.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-backup-index" , "1" ) );
+//    elem2.access_log_rotate_arguments.insert( std::make_pair( "--ac-rotate-max-filesize" , "10M" ) );
+//    elem2.access_log_rotate_key_info = "";
+//    elem2.access_log_rotate_verbose_info = "dummy";
+
+    // unit_test[178] edit(flag:ON,filename:empty)->(flag:ON) NG
+    std::cout << "----------------------------------------" << std::endl;
+    std::cout << "edit_virtualservice_test" << std::endl;
+    std::cout << "(flag:ON,filename:empty)->(flag:ON) NG" << std::endl;
+    std::cout << "----------------------------------------" << std::endl;
+
+    vs_err.setter(false,"");
+    vs->edit_virtualservice( elem2, vs_err );
+
+    BOOST_CHECK_EQUAL( vs_err, true );
+    BOOST_CHECK_EQUAL( vs_err.get_message(), "access log flag change err." );
+    BOOST_CHECK_EQUAL( vs->get_access_log_flag(), false );
+    BOOST_CHECK_EQUAL( vs->get_element().access_log_rotate_key_info, "none" );
+    BOOST_CHECK_EQUAL( vs->get_element().access_log_rotate_verbose_info, "" );
+    BOOST_CHECK_EQUAL( vs->get_access_log_file_name(), vs->get_element().access_log_file_name );
+    BOOST_CHECK( vs->get_access_log_rotate_arguments() == elem1.access_log_rotate_arguments );
+
+    vs->stop();
+
+    usleep( 1000 );
+    cl_thread.join();
+    vs_main.join();
+
+    vs_err.setter(false,"");
+    vs->finalize( vs_err );
+
+    delete vs;
+    }
+
+}
+
+test_suite*    init_unit_test_suite( int argc, char* argv[] ){
+
+    // create unit test suite
+    test_suite* ts = BOOST_TEST_SUITE( "virtualservice_base_test" );
+
+    // add test case to test suite
+//    ts->add( BOOST_TEST_CASE( &virtualservice_tcp_test1 ) );
+//    ts->add( BOOST_TEST_CASE( &virtualservice_tcp_test2 ) );
+//    ts->add( BOOST_TEST_CASE( &virtualservice_tcp_test3 ) );
+//    ts->add( BOOST_TEST_CASE( &virtualservice_tcp_test4 ) );
+//    ts->add( BOOST_TEST_CASE( &virtualservice_tcp_test5 ) );
+//    ts->add( BOOST_TEST_CASE( &virtualservice_tcp_set_socket_option ) );
+//    ts->add( BOOST_TEST_CASE( &virtualservice_tcp_get_ssl_password ) );
+//    ts->add( BOOST_TEST_CASE( &virtualservice_tcp_conv_verify_option ) );
+//    ts->add( BOOST_TEST_CASE( &virtualservice_tcp_conv_ssl_option) );
+//    ts->add( BOOST_TEST_CASE( &virtualservice_tcp_get_ssl_parameter ) );
+//    ts->add( BOOST_TEST_CASE( &virtualservice_tcp_set_ssl_config ) );
+//    ts->add( BOOST_TEST_CASE( &virtualservice_tcp_initialize_to_finalize ) );
+//    ts->add( BOOST_TEST_CASE( &virtualservice_tcp_handle_accept_test ) );
+    ts->add( BOOST_TEST_CASE( &virtualservice_tcp_initialize_test ) );
+//    ts->add( BOOST_TEST_CASE( &virtualservice_tcp_finalize_test ) );
+//    ts->add( BOOST_TEST_CASE( &virtualservice_tcp_edit_virtualservice_test ) );
+
+    framework::master_test_suite().add( ts );
+
+    return 0;
+}
diff --git a/l7vsd/unit_tests/virtualservice_test/vs_tcp_thread_test.cpp b/l7vsd/unit_tests/virtualservice_test/vs_tcp_thread_test.cpp
new file mode 100644 (file)
index 0000000..5402db3
--- /dev/null
@@ -0,0 +1,1321 @@
+
+#include <iostream>
+#include <sstream>
+#include <boost/test/included/unit_test.hpp>
+#include <boost/archive/text_oarchive.hpp>
+#include <boost/archive/text_iarchive.hpp>
+#include <boost/thread.hpp>
+
+#include "stub.h"
+#include "virtualservice.h"
+#include "vs_tcp.h"
+
+#include "protocol_module_test1.h"
+#include "schedule_module_test1.h"
+
+using namespace boost::unit_test;
+
+typedef    boost::asio::ip::tcp::endpoint    tcp_ep_type;
+typedef    boost::asio::ip::udp::endpoint    udp_ep_type;
+
+int    counter;
+
+//Acceptテスト用Client
+void    client(){
+    boost::system::error_code    b_err;
+
+    boost::asio::io_service    dispatcher;
+    boost::asio::ip::tcp::socket    sock( dispatcher );
+    sock.connect( tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) ), b_err );
+    std::cout << "connect" << std::endl;
+
+    usleep( 10000 );
+
+    sock.close( b_err );
+}
+
+class    vs_access{
+protected:
+    boost::asio::io_service        dispatcher;
+
+    l7vs::vs_tcp*                vs;
+    l7vs::l7vsd                    vsd;
+    l7vs::replication*            rep;
+    l7vs::error_code            vs_err;
+
+    boost::condition            cond;
+public:
+    vs_access() : vs( NULL ), rep( NULL ) {}
+    ~vs_access(){}
+
+    void    initialize( l7vs::virtualservice_element& in_elem ){
+        rep    = new l7vs::replication();
+        vs    = new l7vs::vs_tcp( vsd, *rep, in_elem );
+    }
+
+    void    finalize(){
+        vs->finalize( vs_err );
+        usleep(10);
+        if( NULL != vs ){
+            delete vs;
+            vs = NULL;
+        }
+        if( NULL != rep ){
+            delete rep;
+            rep = NULL;
+        }
+    }
+
+    void    start(){
+        cond.notify_all();
+    }
+
+    void    step(){
+        cond.notify_one();
+    }
+
+    l7vs::vs_tcp*    get_vs(){
+        return vs;
+    }
+
+    void    client(){
+        boost::system::error_code    b_err;
+    
+        boost::asio::io_service    client_io;
+        boost::asio::ip::tcp::socket    sock( client_io );
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        sock.connect( tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) ), b_err );
+        std::cout << "connect" << std::endl;
+    
+        usleep( 10000 );
+    
+        sock.close( b_err );
+    }
+
+    void    rs_list_lock(){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        vs->rs_list_lock();
+//        std::cout << "" << std::endl;
+    }
+    void        rs_list_unlock(){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        vs->rs_list_unlock();
+
+    }
+
+    void        get_element( l7vs::virtualservice_element* elem ){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        *(elem) = vs->get_element();
+
+    }
+
+    void        get_qos_upstream( unsigned long long* val ){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        *val = vs->get_qos_upstream();
+
+    }
+    void        get_qos_downstream( unsigned long long* val ){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        *val = vs->get_qos_downstream();
+
+    }
+    void        get_throughput_upstream( unsigned long long* val ){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        *val = vs->get_throughput_upstream();
+
+    }
+    void        get_throughput_downstream( unsigned long long* val ){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        *val = vs->get_throughput_downstream();
+
+    }
+    void        get_up_recv_size( unsigned long long* val ){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        *val = vs->get_up_recv_size();
+
+    }
+    void        get_up_send_size( unsigned long long* val ){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        *val = vs->get_up_send_size();
+
+    }
+    void        get_down_recv_size( unsigned long long* val ){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        *val = vs->get_down_recv_size();
+
+    }
+    void        get_down_send_size( unsigned long long* val ){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        *val = vs->get_down_send_size();
+
+    }
+
+    void        update_up_recv_size( unsigned long long size ){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        vs->update_up_recv_size( size );
+
+    }
+    void        update_up_send_size( unsigned long long size ){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        vs->update_up_send_size( size );
+
+    }
+    void        update_down_recv_size( unsigned long long size ){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        vs->update_down_recv_size( size );
+
+    }
+    void        update_down_send_size( unsigned long long size ){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        vs->update_down_send_size( size );
+
+    }
+
+    void        get_protocol_module( l7vs::protocol_module_base* in_pm ){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        in_pm = vs->get_protocol_module();
+
+    }
+    void        get_schedule_module( l7vs::schedule_module_base* in_sm ){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        in_sm = vs->get_schedule_module();
+
+    }
+
+    void        vs_initialize(){
+        l7vs::error_code    vs_err;
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        vs->initialize( vs_err );
+
+    }
+    void        vs_finalize(){
+        l7vs::error_code    vs_err;
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        vs->finalize( vs_err );
+
+        BOOST_MESSAGE( "finalize." << boost::this_thread::get_id() );
+    }
+
+    void        vs_eq( const l7vs::virtualservice_base* in_vs, bool* ret ){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        *ret = vs->operator==(*in_vs);
+
+    }
+    void        vs_ne( const l7vs::virtualservice_base* in_vs, bool* ret ){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        *ret = vs->operator!=(*in_vs);
+
+    }
+
+    void        set_virtualservice( const l7vs::virtualservice_element& elem ){
+        l7vs::error_code    vs_err;
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        vs->set_virtualservice( elem, vs_err );
+
+    }
+    void        edit_virtualservice( const l7vs::virtualservice_element& elem ){
+        l7vs::error_code    vs_err;
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        vs->edit_virtualservice( elem, vs_err );
+
+    }
+
+    void        add_realserver( const l7vs::virtualservice_element& elem ){
+        l7vs::error_code    vs_err;
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        vs->add_realserver( elem, vs_err );
+
+    }
+    void        edit_realserver( const l7vs::virtualservice_element& elem ){
+        l7vs::error_code    vs_err;
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        vs->edit_realserver( elem, vs_err );
+
+    }
+    void        del_realserver( const l7vs::virtualservice_element& elem ){
+        l7vs::error_code    vs_err;
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        vs->del_realserver( elem, vs_err );
+
+    }
+
+    void        run(){
+        vs->run();
+    }
+    void        stop(){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        vs->stop();
+
+    }
+
+    void        connection_active( const tcp_ep_type& ep ){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        vs->connection_active( ep );
+
+    }
+    void        connection_inactive( const tcp_ep_type& ep ){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        vs->connection_inactive( ep );
+
+    }
+    void        release_session( const l7vs::tcp_session* session_ptr ){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        vs->release_session( session_ptr );
+    }
+};
+
+//test case1  create,initialize,run,stop,finalize,destroy(normal case)
+void    virtualservice_tcp_test1(){
+    counter    = 1;
+
+    //replicationエリアを作成しておく
+    debugg_flug_struct::getInstance().create_rep_area();
+
+    boost::asio::io_service        dispatcher;
+
+    l7vs::l7vsd                    vsd;
+    l7vs::replication            rep;
+
+    debugg_flug_struct::getInstance().pmcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().smcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().param_exist_flag() = false;
+
+    l7vs::error_code            vs_err;
+    boost::system::error_code    test_err;
+
+    std::stringstream    tmp_tcp_ep;
+    std::stringstream    tmp_udp_ep;
+    std::stringstream    tmp_sorry_ep;
+
+    l7vs::virtualservice_element    elem1;
+
+    //set element value
+    elem1.udpmode                    = false;
+    elem1.tcp_accept_endpoint        = 
+            tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem1.udp_recv_endpoint            = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.87" ), (50000) );
+    elem1.realserver_vector.clear();
+    elem1.protocol_module_name        = "PMtest1";
+    elem1.schedule_module_name        = "SMtest1";
+    elem1.protocol_args.clear();
+    elem1.sorry_maxconnection        = 1234LL;
+    elem1.sorry_endpoint            = tcp_ep_type();
+    elem1.sorry_flag                = false;
+    elem1.qos_upstream                = 65535ULL;
+    elem1.qos_downstream            = 32767ULL;
+
+    //vs作成
+    vs_access    vst;
+
+    vst.initialize( elem1 );
+    vst.get_vs()->initialize( vs_err );
+
+    //同一メソッドの多重アクセス
+
+
+    // unit_test[1]  operator==に2スレッドから同時アクセス
+    std::cout << counter++ << std::endl;
+    //比較用のVSを2個作成
+    l7vs::virtualservice_element    elem2;
+    elem2.udpmode                    = false;
+    elem2.tcp_accept_endpoint        = 
+            tcp_ep_type( boost::asio::ip::address::from_string( "10.144.169.30" ), (40000) );
+    elem2.udp_recv_endpoint            = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem2.realserver_vector.clear();
+    elem2.protocol_module_name        = "PMtest1";
+    elem2.schedule_module_name        = "SMtest1";
+    elem2.protocol_args.clear();
+    elem2.sorry_maxconnection        = 1234LL;
+    elem2.sorry_endpoint            = tcp_ep_type();
+    elem2.sorry_flag                = false;
+    elem2.qos_upstream                = 65535ULL;
+    elem2.qos_downstream            = 32767ULL;
+
+    l7vs::vs_tcp*    vs1 = new l7vs::vs_tcp( vsd, rep, elem1 );
+    l7vs::vs_tcp*    vs2 = new l7vs::vs_tcp( vsd, rep, elem2 );
+    bool    retbool1 = true;
+    bool    retbool2 = true;
+
+    BOOST_CHECK( vst.get_vs()->get_element().udpmode == elem1.udpmode );
+    BOOST_CHECK( vst.get_vs()->get_element().tcp_accept_endpoint == elem1.tcp_accept_endpoint );
+    BOOST_CHECK( vst.get_vs()->get_element().udp_recv_endpoint == elem1.udp_recv_endpoint );
+    BOOST_CHECK( vst.get_vs()->get_element().protocol_module_name == elem1.protocol_module_name );
+
+    {
+        boost::thread    eq1( &vs_access::vs_eq, &vst, vs1, &retbool1 );
+        boost::thread    eq2( &vs_access::vs_eq, &vst, vs2, &retbool2 );
+    
+        usleep( 1000 );
+        vst.start();
+        usleep( 1000 );
+        eq1.join();
+        eq2.join();
+    }
+
+    BOOST_CHECK( retbool1 );
+    BOOST_CHECK( !retbool2 );
+
+    // unit_test[2]  operator!=に2スレッドから同時アクセス
+    std::cout << counter++ << std::endl;
+    {
+        boost::thread    ne1( &vs_access::vs_ne, &vst, vs1, &retbool1 );
+        boost::thread    ne2( &vs_access::vs_ne, &vst, vs2, &retbool2 );
+    
+        usleep( 1000 );
+        vst.start();
+        usleep( 1000 );
+        ne1.join();
+        ne2.join();
+    }
+
+    BOOST_CHECK( !retbool1 );
+    BOOST_CHECK( retbool2 );
+
+    // unit_test[3]  rs_list_lockに2スレッドから同時アクセス
+    std::cout << counter++ << std::endl;
+    {
+        boost::thread    lk1( &vs_access::rs_list_lock, &vst );
+        boost::thread    lk2( &vs_access::rs_list_lock, &vst );
+
+        usleep( 1000 );
+        vst.start();
+        usleep( 1000 );
+        lk1.join();
+        lk2.join();
+    }
+    BOOST_CHECK( vst.get_vs()->get_ref_count() == 2ULL );
+
+    // unit_test[4]  rs_list_unlockに2スレッドから同時アクセス
+    std::cout << counter++ << std::endl;
+    {
+        boost::thread    ulk1( &vs_access::rs_list_unlock, &vst );
+        boost::thread    ulk2( &vs_access::rs_list_unlock, &vst );
+
+        usleep( 1000 );
+        vst.start();
+        usleep( 1000 );
+        ulk1.join();
+        ulk2.join();
+    }
+    BOOST_CHECK( vst.get_vs()->get_ref_count() == 0ULL );
+
+    // unit_test[5]  get_elementに2スレッドから同時アクセス
+    l7vs::virtualservice_element    test_elem1;
+    l7vs::virtualservice_element    test_elem2;
+    std::cout << counter++ << std::endl;
+    {
+        boost::thread    get_elem1( &vs_access::get_element, &vst, &test_elem1 );
+        boost::thread    get_elem2( &vs_access::get_element, &vst, &test_elem2 );
+
+        usleep( 1000 );
+        vst.start();
+        usleep( 1000 );
+        get_elem1.join();
+        get_elem2.join();
+    }
+    BOOST_CHECK( test_elem1 == test_elem2 );
+
+    // unit_test[6]  connection_activeに2スレッドから同時アクセス
+    std::cout << counter++ << std::endl;
+    //RSを2つ追加しておく
+    l7vs::virtualservice_element    elem3;
+    //set element value
+    elem3.udpmode                    = false;
+    elem3.tcp_accept_endpoint        = 
+            tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem3.udp_recv_endpoint            = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem3.realserver_vector.clear();
+    elem3.protocol_module_name        = "PMtest1";
+    elem3.schedule_module_name        = "SMtest1";
+    elem3.protocol_args.clear();
+    elem3.sorry_maxconnection        = 1234LL;
+    elem3.sorry_endpoint            = tcp_ep_type();
+    elem3.sorry_flag                = false;
+    elem3.qos_upstream                = 65535ULL;
+    elem3.qos_downstream            = 32767ULL;
+    for( size_t i = 0; i < 2; ++i ){
+        l7vs::realserver_element    rs_elem;
+        rs_elem.tcp_endpoint = tcp_ep_type( boost::asio::ip::address::from_string( "192.168.10.10" ), (i+8080) );
+        elem3.realserver_vector.push_back( rs_elem );
+    }
+    vst.get_vs()->add_realserver( elem3, vs_err );
+    BOOST_CHECK( vst.get_vs()->get_rs_list().size() == 2 );
+    tcp_ep_type        ep1 = elem3.realserver_vector[0].tcp_endpoint;
+    tcp_ep_type        ep2 = elem3.realserver_vector[1].tcp_endpoint;
+    {
+        boost::thread    con_act1( &vs_access::connection_active, &vst, ep1 );
+        boost::thread    con_act2( &vs_access::connection_active, &vst, ep2 );
+
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+        con_act1.join();
+        con_act2.join();
+    }
+    BOOST_CHECK( vst.get_vs()->get_element().realserver_vector[0].get_active() == 1 );
+    BOOST_CHECK( vst.get_vs()->get_element().realserver_vector[1].get_active() == 1 );
+
+    // unit_test[7]  connection_inactiveに2スレッドから同時アクセス
+    std::cout << counter++ << std::endl;
+    {
+        boost::thread    con_inact1( &vs_access::connection_inactive, &vst, ep2 );
+        boost::thread    con_inact2( &vs_access::connection_inactive, &vst, ep1 );
+
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+        con_inact1.join();
+        con_inact2.join();
+    }
+    BOOST_CHECK( vst.get_vs()->get_element().realserver_vector[0].get_active() == 0 );
+    BOOST_CHECK( vst.get_vs()->get_element().realserver_vector[1].get_active() == 0 );
+    BOOST_CHECK( vst.get_vs()->get_element().realserver_vector[0].get_inact() == 1 );
+    BOOST_CHECK( vst.get_vs()->get_element().realserver_vector[1].get_inact() == 1 );
+
+
+//    vst.get_vs()->initialize( vs_err );
+    boost::thread    vs_run( &vs_access::run, &vst );
+    usleep( 1000 );
+    BOOST_MESSAGE( vst.get_vs()->get_pool_sessions().size() );
+    BOOST_CHECK( vst.get_vs()->get_pool_sessions().size() == (l7vs::virtualservice_base::SESSION_POOL_NUM_DEFAULT - 1) );
+
+    // unit_test[8]  release_sessionに2スレッドから同時アクセス
+    // unit_test[9]  stopに2スレッドから同時アクセス
+    //あらかじめclientからconnectして、ActiveSessionを2つ以上にしておく
+    std::cout << counter++ << std::endl;
+    std::cout << counter++ << std::endl;
+    {
+        usleep( 1000 );
+        boost::thread    cl1( &client );
+        boost::thread    cl2( &client );
+        usleep( 1000000 );
+
+        BOOST_CHECK( vst.get_vs()->get_pool_sessions().size() == l7vs::virtualservice_base::SESSION_POOL_NUM_DEFAULT-3 );
+        BOOST_CHECK( vst.get_vs()->get_waiting_sessions().size() == 1 );
+        BOOST_CHECK( vst.get_vs()->get_active_sessions().size() == 2 );
+
+        cl1.join();
+        cl2.join();
+
+        //stopのスレッドを作成
+        boost::thread    stop1( &vs_access::stop, &vst );
+        boost::thread    stop2( &vs_access::stop, &vst );
+
+        usleep( 100000 );
+        vst.start();
+        usleep( 100000 );
+        //stopの流れでrelease_sessionも呼ばれる
+        stop1.join();
+        stop2.join();
+    }
+    std::cout << vst.get_vs()->get_pool_sessions().size() << std::endl;
+    BOOST_CHECK( vst.get_vs()->get_pool_sessions().size() == l7vs::virtualservice_base::SESSION_POOL_NUM_DEFAULT-1 );
+    std::cout << vst.get_vs()->get_waiting_sessions().size() << std::endl;
+    BOOST_CHECK( vst.get_vs()->get_waiting_sessions().size() == 1 );
+    vs_run.join();
+
+    // unit_test[10]  get_qos_upstreamに2スレッドから同時アクセス
+    std::cout << counter++ << std::endl;
+    unsigned long long    qos1 = 0;
+    unsigned long long    qos2 = 0;
+    {
+        boost::thread    qosup1( &vs_access::get_qos_upstream, &vst, &qos1 );
+        boost::thread    qosup2( &vs_access::get_qos_upstream, &vst, &qos2 );
+
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+        qosup1.join();
+        qosup2.join();
+    }
+    BOOST_CHECK( qos1 == elem1.qos_upstream );
+    BOOST_CHECK( qos2 == elem1.qos_upstream );
+
+    // unit_test[11]  get_qos_downstreamに2スレッドから同時アクセス
+    std::cout << counter++ << std::endl;
+    {
+        boost::thread    qosdown1( &vs_access::get_qos_downstream, &vst, &qos1 );
+        boost::thread    qosdown2( &vs_access::get_qos_downstream, &vst, &qos2 );
+
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+        qosdown1.join();
+        qosdown2.join();
+    }
+    BOOST_CHECK( qos1 == elem1.qos_downstream );
+    BOOST_CHECK( qos2 == elem1.qos_downstream );
+
+    // unit_test[12]  get_throughput_upstreamに2スレッドから同時アクセス
+    std::cout << counter++ << std::endl;
+    unsigned long long    throughput1 = 65535ULL;
+    unsigned long long    throughput2 = 65535ULL;
+    {
+        boost::thread    get_throughput1( &vs_access::get_throughput_upstream, &vst, &throughput1 );
+        boost::thread    get_throughput2( &vs_access::get_throughput_upstream, &vst, &throughput2 );
+
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+        get_throughput1.join();
+        get_throughput2.join();
+    }
+    BOOST_CHECK( throughput1 == 0ULL );
+    BOOST_CHECK( throughput1 == 0ULL );
+
+    // unit_test[13]  get_throughput_downstreamに2スレッドから同時アクセス
+    std::cout << counter++ << std::endl;
+    throughput1 = 65535ULL;
+    throughput2 = 65535ULL;
+    {
+        boost::thread    thread1( &vs_access::get_throughput_downstream, &vst, &throughput1 );
+        boost::thread    thread2( &vs_access::get_throughput_downstream, &vst, &throughput2 );
+
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+        thread1.join();
+        thread2.join();
+    }
+    BOOST_CHECK( throughput1 == 0ULL );
+    BOOST_CHECK( throughput1 == 0ULL );
+
+    // unit_test[14]  get_up_recv_sizeに2スレッドから同時アクセス
+    std::cout << counter++ << std::endl;
+    unsigned long long    recv_size1    = 65535ULL;
+    unsigned long long    recv_size2    = 65535ULL;
+    {
+        boost::thread    thread1( &vs_access::get_up_recv_size, &vst, &recv_size1 );
+        boost::thread    thread2( &vs_access::get_up_recv_size, &vst, &recv_size2 );
+
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+        thread1.join();
+        thread2.join();
+    }
+    BOOST_CHECK( recv_size1 == 0ULL );
+    BOOST_CHECK( recv_size2 == 0ULL );
+
+    // unit_test[15]  get_up_send_sizeに2スレッドから同時アクセス
+    std::cout << counter++ << std::endl;
+    recv_size1    = 65535ULL;
+    recv_size2    = 65535ULL;
+    {
+        boost::thread    thread1( &vs_access::get_up_send_size, &vst, &recv_size1 );
+        boost::thread    thread2( &vs_access::get_up_send_size, &vst, &recv_size2 );
+
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+        thread1.join();
+        thread2.join();
+    }
+    BOOST_CHECK( recv_size1 == 0ULL );
+    BOOST_CHECK( recv_size2 == 0ULL );
+
+    // unit_test[16]  get_down_recv_sizeに2スレッドから同時アクセス
+    std::cout << counter++ << std::endl;
+    recv_size1    = 65535ULL;
+    recv_size2    = 65535ULL;
+    {
+        boost::thread    thread1( &vs_access::get_down_recv_size, &vst, &recv_size1 );
+        boost::thread    thread2( &vs_access::get_down_recv_size, &vst, &recv_size2 );
+
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+        thread1.join();
+        thread2.join();
+    }
+    BOOST_CHECK( recv_size1 == 0ULL );
+    BOOST_CHECK( recv_size2 == 0ULL );
+
+    // unit_test[17]  get_down_send_sizeに2スレッドから同時アクセス
+    std::cout << counter++ << std::endl;
+    recv_size1    = 65535ULL;
+    recv_size2    = 65535ULL;
+    {
+        boost::thread    thread1( &vs_access::get_down_send_size, &vst, &recv_size1 );
+        boost::thread    thread2( &vs_access::get_down_send_size, &vst, &recv_size2 );
+
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+        thread1.join();
+        thread2.join();
+    }
+    BOOST_CHECK( recv_size1 == 0ULL );
+    BOOST_CHECK( recv_size2 == 0ULL );
+
+    // unit_test[18]  update_up_recv_sizeに2スレッドから同時アクセス
+    std::cout << counter++ << std::endl;
+    {
+        boost::thread    thread1( &vs_access::update_up_recv_size, &vst, 1000ULL );
+        boost::thread    thread2( &vs_access::update_up_recv_size, &vst, 200ULL );
+
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+        thread1.join();
+        thread2.join();
+    }
+    recv_size1 = vst.get_vs()->get_up_recv_size();
+    BOOST_CHECK( recv_size1 == 1200ULL );
+
+    // unit_test[19]  update_up_send_sizeに2スレッドから同時アクセス
+    std::cout << counter++ << std::endl;
+    {
+        boost::thread    thread1( &vs_access::update_up_send_size, &vst, 100ULL );
+        boost::thread    thread2( &vs_access::update_up_send_size, &vst, 300ULL );
+
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+        thread1.join();
+        thread2.join();
+    }
+    recv_size1 = vst.get_vs()->get_up_send_size();
+    BOOST_CHECK( recv_size1 == 400ULL );
+
+    // unit_test[20]  update_down_recv_sizeに2スレッドから同時アクセス
+    std::cout << counter++ << std::endl;
+    {
+        boost::thread    thread1( &vs_access::update_down_recv_size, &vst, 10ULL );
+        boost::thread    thread2( &vs_access::update_down_recv_size, &vst, 500ULL );
+
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+        thread1.join();
+        thread2.join();
+    }
+    recv_size1 = vst.get_vs()->get_down_recv_size();
+    BOOST_CHECK( recv_size1 == 510ULL );
+
+    // unit_test[21]  update_down_send_sizeに2スレッドから同時アクセス
+    std::cout << counter++ << std::endl;
+    {
+        boost::thread    thread1( &vs_access::update_down_send_size, &vst, 8000ULL );
+        boost::thread    thread2( &vs_access::update_down_send_size, &vst, 5000ULL );
+
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+        thread1.join();
+        thread2.join();
+    }
+    recv_size1 = vst.get_vs()->get_down_send_size();
+    BOOST_CHECK( recv_size1 == 13000ULL );
+
+    // unit_test[22]  get_protocol_moduleに2スレッドから同時アクセス
+    std::cout << counter++ << std::endl;
+    l7vs::protocol_module_base*    pmb1 = NULL;
+    l7vs::protocol_module_base*    pmb2 = NULL;
+    {
+        boost::thread    thread1( &vs_access::get_protocol_module, &vst, pmb1 );
+        boost::thread    thread2( &vs_access::get_protocol_module, &vst, pmb2 );
+
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+        thread1.join();
+        thread2.join();
+    }
+    BOOST_CHECK( pmb1 == pmb2 );
+
+    // unit_test[23]  get_schedule_moduleに2スレッドから同時アクセス
+    std::cout << counter++ << std::endl;
+    l7vs::schedule_module_base*    smb1 = NULL;
+    l7vs::schedule_module_base*    smb2 = NULL;
+    {
+        boost::thread    thread1( &vs_access::get_schedule_module, &vst, smb1 );
+        boost::thread    thread2( &vs_access::get_schedule_module, &vst, smb2 );
+
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+        thread1.join();
+        thread2.join();
+    }
+    BOOST_CHECK( smb1 == smb2 );
+
+
+    vst.finalize();
+
+    //replicationエリアを開放する
+    debugg_flug_struct::getInstance().destroy_rep_area();
+}
+
+//組み合わせアクセステスト
+void    virtualservice_tcp_test2(){
+    //replicationエリアを作成しておく
+    debugg_flug_struct::getInstance().create_rep_area();
+
+    boost::asio::io_service        dispatcher;
+
+    l7vs::l7vsd                    vsd;
+    l7vs::replication            rep();
+
+    debugg_flug_struct::getInstance().pmcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().smcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().param_exist_flag() = false;
+
+    l7vs::error_code            vs_err;
+    boost::system::error_code    test_err;
+
+    std::stringstream    tmp_tcp_ep;
+    std::stringstream    tmp_udp_ep;
+    std::stringstream    tmp_sorry_ep;
+
+    l7vs::virtualservice_element    elem1;
+
+    //set element value
+    elem1.udpmode                    = false;
+    elem1.tcp_accept_endpoint        = 
+            tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem1.udp_recv_endpoint            = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem1.realserver_vector.clear();
+    elem1.protocol_module_name        = "PMtest1";
+    elem1.schedule_module_name        = "SMtest1";
+    elem1.protocol_args.clear();
+    elem1.sorry_maxconnection        = 1234LL;
+    elem1.sorry_endpoint            = tcp_ep_type();
+    elem1.sorry_flag                = false;
+    elem1.qos_upstream                = 65535ULL;
+    elem1.qos_downstream            = 32767ULL;
+
+    //vs作成
+    vs_access    vst;
+    vst.initialize( elem1 );
+    vst.get_vs()->initialize( vs_err );
+    //待ち受け開始
+    boost::thread    vs_run( &vs_access::run, &vst );
+    usleep( 1000 );
+
+    // unit_test[24]  sessionがActiveになるときに、release_sessionされるケース
+    // unit_test[25]  sessionがActiveになるときにfinalize
+    // unit_test[26]  release_sessionされるときにfinalize
+    std::cout << counter++ << std::endl;
+    std::cout << counter++ << std::endl;
+    std::cout << counter++ << std::endl;
+    // finalizeを呼べば、stopされてrelease_sessionされる。
+    {
+        boost::thread    thread1( &vs_access::client, &vst );
+        boost::thread    thread2( &vs_access::vs_finalize, &vst );
+
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+        thread1.join();
+        thread2.join();
+    }
+
+    vst.get_vs()->stop();
+    usleep( 1000 );
+    vs_run.join();
+
+    vst.finalize();
+    usleep( 1000 );
+
+    //replicationエリアを開放する
+    debugg_flug_struct::getInstance().destroy_rep_area();
+}
+
+void    virtualservice_tcp_test3(){
+    //replicationエリアを作成しておく
+    debugg_flug_struct::getInstance().create_rep_area();
+
+//    boost::asio::io_service        dispatcher;
+
+    l7vs::l7vsd                    vsd;
+    l7vs::replication            rep();
+
+    debugg_flug_struct::getInstance().pmcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().smcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().param_exist_flag() = false;
+
+    l7vs::error_code            vs_err;
+    boost::system::error_code    test_err;
+
+    std::stringstream    tmp_tcp_ep;
+    std::stringstream    tmp_udp_ep;
+    std::stringstream    tmp_sorry_ep;
+
+    l7vs::virtualservice_element    elem1;
+
+    //set element value
+    elem1.udpmode                    = false;
+    elem1.tcp_accept_endpoint        = 
+            tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem1.udp_recv_endpoint            = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem1.realserver_vector.clear();
+    elem1.protocol_module_name        = "PMtest1";
+    elem1.schedule_module_name        = "SMtest1";
+    elem1.protocol_args.clear();
+    elem1.sorry_maxconnection        = 1234LL;
+    elem1.sorry_endpoint            = tcp_ep_type();
+    elem1.sorry_flag                = false;
+    elem1.qos_upstream                = 65535ULL;
+    elem1.qos_downstream            = 32767ULL;
+
+    //vs作成
+    vs_access    vst;
+    vst.initialize( elem1 );
+
+    //rs追加
+    // unit_test[27]  add_rsとrs_list_lock
+    std::cout << counter++ << std::endl;
+    //RS追加用のelement準備
+    l7vs::virtualservice_element    elem2;
+    //set element value
+    elem2.udpmode                    = false;
+    elem2.tcp_accept_endpoint        = 
+            tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem2.udp_recv_endpoint            = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem2.realserver_vector.clear();
+    elem2.protocol_module_name        = "PMtest1";
+    elem2.schedule_module_name        = "SMtest1";
+    elem2.protocol_args.clear();
+    elem2.sorry_maxconnection        = 1234LL;
+    elem2.sorry_endpoint            = tcp_ep_type();
+    elem2.sorry_flag                = false;
+    elem2.qos_upstream                = 65535ULL;
+    elem2.qos_downstream            = 32767ULL;
+    for( size_t i = 0; i < 2; ++i ){
+        l7vs::realserver_element    rs_elem;
+        rs_elem.tcp_endpoint = tcp_ep_type( boost::asio::ip::address::from_string( "192.168.10.10" ), (i+8080) );
+        rs_elem.weight    = 10+i;
+        elem2.realserver_vector.push_back( rs_elem );
+    }
+    {
+        boost::thread    thread1( &vs_access::rs_list_lock, &vst );
+        boost::thread    thread2( &vs_access::add_realserver, &vst, elem2 );
+
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+        BOOST_CHECK( vst.get_vs()->get_ref_count() == 1 );
+        //ref_countが1のままだとadd_realserverができないのでunlockする
+        vst.get_vs()->rs_list_unlock();
+        usleep( 100000 );
+         thread1.join();
+         thread2.join();
+    }
+    BOOST_CHECK( vst.get_vs()->get_rs_list().size() == 2 );
+    BOOST_CHECK( vst.get_vs()->get_ref_count() == 0 );
+
+    //一旦削除
+    vst.get_vs()->del_realserver( elem2, vs_err );
+
+    // unit_test[28]  add_rsとrs_list_unlock(ref_countが1でスタートした場合)
+    std::cout << counter++ << std::endl;
+    {
+        //あらかじめlockしておいてref_countを1にしておく
+        vst.get_vs()->rs_list_lock();
+        BOOST_CHECK( vst.get_vs()->get_ref_count() == 1 );
+
+        boost::thread    thread1( &vs_access::add_realserver, &vst, elem2 );
+        boost::thread    thread2( &vs_access::rs_list_unlock, &vst );
+
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+        thread1.join();
+        thread2.join();
+    }
+    BOOST_CHECK( vst.get_vs()->get_rs_list().size() == 2 );
+    BOOST_CHECK( vst.get_vs()->get_ref_count() == 0 );
+
+    // unit_test[29]  add_rsとconnection_active
+    std::cout << counter++ << std::endl;
+    //RS追加用のelement準備
+    l7vs::virtualservice_element    elem3;
+    //set element value
+    elem3.udpmode                    = false;
+    elem3.tcp_accept_endpoint        = 
+            tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem3.udp_recv_endpoint            = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem3.realserver_vector.clear();
+    elem3.protocol_module_name        = "PMtest1";
+    elem3.schedule_module_name        = "SMtest1";
+    elem3.protocol_args.clear();
+    elem3.sorry_maxconnection        = 1234LL;
+    elem3.sorry_endpoint            = tcp_ep_type();
+    elem3.sorry_flag                = false;
+    elem3.qos_upstream                = 65535ULL;
+    elem3.qos_downstream            = 32767ULL;
+    for( size_t i = 0; i < 2; ++i ){
+        l7vs::realserver_element    rs_elem;
+        rs_elem.tcp_endpoint = tcp_ep_type( boost::asio::ip::address::from_string( "192.168.10.10" ), (i+8090) );
+        rs_elem.weight    = 5+i;
+        elem3.realserver_vector.push_back( rs_elem );
+    }
+    {
+        boost::thread    thread1( &vs_access::add_realserver, &vst, elem3 );
+        boost::thread    thread2( &vs_access::connection_active, &vst, elem2.realserver_vector[0].tcp_endpoint );
+
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+
+        thread1.join();
+        thread2.join();
+    }
+    BOOST_CHECK( vst.get_vs()->get_rs_list().size() == 4 );
+    for( std::list<l7vs::realserver>::iterator itr = vst.get_vs()->get_rs_list().begin();
+         itr != vst.get_vs()->get_rs_list().end(); ++itr ){
+        if( itr->tcp_endpoint == elem2.realserver_vector[0].tcp_endpoint ){
+            std::cout << "active_conn check" << std::endl;
+            BOOST_CHECK( itr->get_active() == 1 );
+            BOOST_CHECK( itr->get_inact() == 0 );
+            break;
+        }
+    }
+
+    //一旦削除
+    vst.get_vs()->del_realserver( elem3, vs_err );
+
+    // unit_test[30]  add_rsとconnection_inactive
+    std::cout << counter++ << std::endl;
+    {
+        boost::thread    thread1( &vs_access::add_realserver, &vst, elem3 );
+        boost::thread    thread2( &vs_access::connection_inactive, &vst, elem2.realserver_vector[0].tcp_endpoint );
+
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+
+        thread1.join();
+        thread2.join();
+    }
+    BOOST_CHECK( vst.get_vs()->get_rs_list().size() == 4 );
+    for( std::list<l7vs::realserver>::iterator itr = vst.get_vs()->get_rs_list().begin();
+         itr != vst.get_vs()->get_rs_list().end(); ++itr ){
+        if( itr->tcp_endpoint == elem2.realserver_vector[0].tcp_endpoint ){
+            std::cout << "inactive_conn check" << std::endl;
+            BOOST_CHECK( itr->get_active() == 0 );
+            BOOST_CHECK( itr->get_inact() == 1 );
+            break;
+        }
+    }
+
+    //rs変更
+    // unit_test[31]  edit_rsとrs_list_lock
+    std::cout << counter++ << std::endl;
+    //RS編集用のelement準備
+    l7vs::virtualservice_element    elem4;
+    //set element value
+    elem4.udpmode                    = false;
+    elem4.tcp_accept_endpoint        = 
+            tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem4.udp_recv_endpoint            = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem4.realserver_vector.clear();
+    elem4.protocol_module_name        = "PMtest1";
+    elem4.schedule_module_name        = "SMtest1";
+    elem4.protocol_args.clear();
+    elem4.sorry_maxconnection        = 1234LL;
+    elem4.sorry_endpoint            = tcp_ep_type();
+    elem4.sorry_flag                = false;
+    elem4.qos_upstream                = 65535ULL;
+    elem4.qos_downstream            = 32767ULL;
+    for( size_t i = 0; i < 2; ++i ){
+        l7vs::realserver_element    rs_elem;
+        rs_elem.tcp_endpoint = tcp_ep_type( boost::asio::ip::address::from_string( "192.168.10.10" ), (i+8080) );
+        rs_elem.weight    = 5+i;
+        elem4.realserver_vector.push_back( rs_elem );
+    }
+    {
+        boost::thread    thread1( &vs_access::edit_realserver, &vst, elem4 );
+        boost::thread    thread2( &vs_access::rs_list_lock, &vst );
+
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+        BOOST_CHECK( vst.get_vs()->get_ref_count() == 1 );
+        //ref_countが1のままだとedit_realserverができないのでunlockする
+        vst.get_vs()->rs_list_unlock();
+        BOOST_CHECK( vst.get_vs()->get_ref_count() == 0 );
+        usleep( 100000 );
+        thread1.join();
+        thread2.join();
+    }
+    BOOST_CHECK( vst.get_vs()->get_rs_list().size() == 4 );
+
+    // unit_test[32]  edit_rsとrs_list_unlock
+    std::cout << counter++ << std::endl;
+    {
+        //あらかじめlockしておいてref_countを1にしておく
+        vst.get_vs()->rs_list_lock();
+        BOOST_CHECK( vst.get_vs()->get_ref_count() == 1 );
+
+        boost::thread    thread1( &vs_access::edit_realserver, &vst, elem2 );
+        boost::thread    thread2( &vs_access::rs_list_unlock, &vst );
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+        thread1.join();
+        thread2.join();
+    }
+    BOOST_CHECK( vst.get_vs()->get_rs_list().size() == 4 );
+    BOOST_CHECK( vst.get_vs()->get_ref_count() == 0 );
+
+    // unit_test[33]  edit_rsとconnection_active
+    std::cout << counter++ << std::endl;
+    elem4.realserver_vector.clear();
+    for( size_t i = 0; i < 2; ++i ){
+        l7vs::realserver_element    rs_elem;
+        rs_elem.tcp_endpoint = tcp_ep_type( boost::asio::ip::address::from_string( "192.168.10.10" ), (i+8080) );
+        rs_elem.weight    = 100+i;
+        elem4.realserver_vector.push_back( rs_elem );
+    }
+    {
+        boost::thread    thread1( &vs_access::edit_realserver, &vst, elem4 );
+        boost::thread    thread2( &vs_access::connection_active, &vst, elem2.realserver_vector[0].tcp_endpoint );
+
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+
+        thread1.join();
+        thread2.join();
+    }
+    BOOST_CHECK( vst.get_vs()->get_rs_list().size() == 4 );
+    for( std::list<l7vs::realserver>::iterator itr = vst.get_vs()->get_rs_list().begin();
+         itr != vst.get_vs()->get_rs_list().end(); ++itr ){
+        if( itr->tcp_endpoint == elem2.realserver_vector[0].tcp_endpoint ){
+            std::cout << "active_conn check" << std::endl;
+            BOOST_CHECK( itr->get_active() == 1 );
+            BOOST_CHECK( itr->get_inact() == 1 );
+            break;
+        }
+    }
+    // unit_test[34]  edit_rsとconnection_inactive
+    std::cout << counter++ << std::endl;
+    {
+        boost::thread    thread1( &vs_access::edit_realserver, &vst, elem4 );
+        boost::thread    thread2( &vs_access::connection_inactive, &vst, elem2.realserver_vector[0].tcp_endpoint );
+
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+
+        thread1.join();
+        thread2.join();
+    }
+    BOOST_CHECK( vst.get_vs()->get_rs_list().size() == 4 );
+    for( std::list<l7vs::realserver>::iterator itr = vst.get_vs()->get_rs_list().begin();
+         itr != vst.get_vs()->get_rs_list().end(); ++itr ){
+        if( itr->tcp_endpoint == elem2.realserver_vector[0].tcp_endpoint ){
+            std::cout << "inactive_conn check" << std::endl;
+            BOOST_CHECK( itr->get_active() == 0 );
+            BOOST_CHECK( itr->get_inact() == 2 );
+            break;
+        }
+    }
+
+    //rs削除
+    // unit_test[35]  del_rsとrs_list_lock
+    std::cout << counter++ << std::endl;
+    {
+        boost::thread    thread1( &vs_access::del_realserver, &vst, elem4 );
+        boost::thread    thread2( &vs_access::rs_list_lock, &vst );
+
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+        BOOST_CHECK( vst.get_vs()->get_ref_count() == 1 );
+        //ref_countが1のままだとedit_realserverができないのでunlockする
+        vst.get_vs()->rs_list_unlock();
+        BOOST_CHECK( vst.get_vs()->get_ref_count() == 0 );
+        usleep( 100000 );
+        thread1.join();
+        thread2.join();
+    }
+    BOOST_CHECK( vst.get_vs()->get_rs_list().size() == 2 );
+
+    //再度追加
+    vst.get_vs()->add_realserver( elem4, vs_err );
+
+    // unit_test[36]  del_rsとrs_list_unlock
+    std::cout << counter++ << std::endl;
+    {
+        //あらかじめlockしておいてref_countを1にしておく
+        vst.get_vs()->rs_list_lock();
+        BOOST_CHECK( vst.get_vs()->get_ref_count() == 1 );
+
+        boost::thread    thread1( &vs_access::del_realserver, &vst, elem4 );
+        boost::thread    thread2( &vs_access::rs_list_unlock, &vst );
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+        thread1.join();
+        thread2.join();
+    }
+    BOOST_CHECK( vst.get_vs()->get_rs_list().size() == 2 );
+    BOOST_CHECK( vst.get_vs()->get_ref_count() == 0 );
+
+    //再度追加
+    vst.get_vs()->add_realserver( elem4, vs_err );
+
+    //del_rsとconnection_active
+    {
+        boost::thread    thread1( &vs_access::del_realserver, &vst, elem4 );
+        boost::thread    thread2( &vs_access::connection_active, &vst, elem3.realserver_vector[0].tcp_endpoint );
+
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+
+        thread1.join();
+        thread2.join();
+    }
+    BOOST_CHECK( vst.get_vs()->get_rs_list().size() == 2 );
+    for( std::list<l7vs::realserver>::iterator itr = vst.get_vs()->get_rs_list().begin();
+         itr != vst.get_vs()->get_rs_list().end(); ++itr ){
+        if( itr->tcp_endpoint == elem2.realserver_vector[0].tcp_endpoint ){
+            std::cout << "active_conn check" << std::endl;
+            BOOST_CHECK( itr->get_active() == 1 );
+            BOOST_CHECK( itr->get_inact() == 0 );
+            break;
+        }
+    }
+
+    //再度追加
+    vst.get_vs()->add_realserver( elem4, vs_err );
+    //del_rsとconnection_inactive
+    {
+        boost::thread    thread1( &vs_access::del_realserver, &vst, elem4 );
+        boost::thread    thread2( &vs_access::connection_inactive, &vst, elem3.realserver_vector[0].tcp_endpoint );
+
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+
+        thread1.join();
+        thread2.join();
+    }
+    BOOST_CHECK( vst.get_vs()->get_rs_list().size() == 2 );
+    for( std::list<l7vs::realserver>::iterator itr = vst.get_vs()->get_rs_list().begin();
+         itr != vst.get_vs()->get_rs_list().end(); ++itr ){
+        if( itr->tcp_endpoint == elem2.realserver_vector[0].tcp_endpoint ){
+            std::cout << "inactive_conn check" << std::endl;
+            BOOST_CHECK( itr->get_active() == 0 );
+            BOOST_CHECK( itr->get_inact() == 1 );
+            break;
+        }
+    }
+
+    vst.finalize();
+    //replicationエリアを開放する
+    debugg_flug_struct::getInstance().destroy_rep_area();
+}
+
+
+test_suite*    init_unit_test_suite( int argc, char* argv[] ){
+
+    // create unit test suite
+    test_suite* ts = BOOST_TEST_SUITE( "virtualservice_base_test" );
+
+    // add test case to test suite
+    ts->add( BOOST_TEST_CASE( &virtualservice_tcp_test1 ) );
+    ts->add( BOOST_TEST_CASE( &virtualservice_tcp_test2 ) );
+//    ts->add( BOOST_TEST_CASE( &virtualservice_tcp_test3 ) );
+
+    framework::master_test_suite().add( ts );
+
+    return 0;
+}
diff --git a/l7vsd/unit_tests/virtualservice_test/vs_tcp_thread_test2.cpp b/l7vsd/unit_tests/virtualservice_test/vs_tcp_thread_test2.cpp
new file mode 100644 (file)
index 0000000..d0a8380
--- /dev/null
@@ -0,0 +1,762 @@
+
+#include <iostream>
+#include <sstream>
+#include <boost/test/included/unit_test.hpp>
+#include <boost/archive/text_oarchive.hpp>
+#include <boost/archive/text_iarchive.hpp>
+#include <boost/thread.hpp>
+
+#include "stub.h"
+#include "virtualservice.h"
+#include "vs_tcp.h"
+
+#include "protocol_module_test1.h"
+#include "schedule_module_test1.h"
+
+using namespace boost::unit_test;
+
+typedef    boost::asio::ip::tcp::endpoint    tcp_ep_type;
+typedef    boost::asio::ip::udp::endpoint    udp_ep_type;
+
+int    counter;
+
+//Acceptテスト用Client
+void    client(){
+    boost::system::error_code    b_err;
+
+    boost::asio::io_service    dispatcher;
+    boost::asio::ip::tcp::socket    sock( dispatcher );
+    sock.connect( tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) ), b_err );
+    std::cout << "connect" << std::endl;
+
+    usleep( 10000 );
+
+    sock.close( b_err );
+}
+
+class    vs_access{
+protected:
+    boost::asio::io_service        dispatcher;
+
+    l7vs::vs_tcp*                vs;
+    l7vs::l7vsd                    vsd;
+    l7vs::replication*            rep;
+    l7vs::error_code            vs_err;
+
+    boost::condition            cond;
+public:
+    vs_access() : vs( NULL ), rep( NULL ) {}
+    ~vs_access(){}
+
+    void    initialize( l7vs::virtualservice_element& in_elem ){
+        rep    = new l7vs::replication();
+        vs    = new l7vs::vs_tcp( vsd, *rep, in_elem );
+    }
+
+    void    finalize(){
+        vs->finalize( vs_err );
+        usleep(10);
+        if( NULL != vs ){
+            delete vs;
+            vs = NULL;
+        }
+        if( NULL != rep ){
+            delete rep;
+            rep = NULL;
+        }
+    }
+
+    void    start(){
+        cond.notify_all();
+    }
+
+    void    step(){
+        cond.notify_one();
+    }
+
+    l7vs::vs_tcp*    get_vs(){
+        return vs;
+    }
+
+    void    client(){
+        boost::system::error_code    b_err;
+    
+        boost::asio::io_service    client_io;
+        boost::asio::ip::tcp::socket    sock( client_io );
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        sock.connect( tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) ), b_err );
+        std::cout << "connect" << std::endl;
+    
+        usleep( 10000 );
+    
+        sock.close( b_err );
+    }
+
+    void    rs_list_lock(){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        vs->rs_list_lock();
+//        std::cout << "" << std::endl;
+    }
+    void        rs_list_unlock(){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        vs->rs_list_unlock();
+
+    }
+
+    void        get_element( l7vs::virtualservice_element* elem ){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        *(elem) = vs->get_element();
+
+    }
+
+    void        get_qos_upstream( unsigned long long* val ){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        *val = vs->get_qos_upstream();
+
+    }
+    void        get_qos_downstream( unsigned long long* val ){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        *val = vs->get_qos_downstream();
+
+    }
+    void        get_throughput_upstream( unsigned long long* val ){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        *val = vs->get_throughput_upstream();
+
+    }
+    void        get_throughput_downstream( unsigned long long* val ){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        *val = vs->get_throughput_downstream();
+
+    }
+    void        get_up_recv_size( unsigned long long* val ){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        *val = vs->get_up_recv_size();
+
+    }
+    void        get_up_send_size( unsigned long long* val ){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        *val = vs->get_up_send_size();
+
+    }
+    void        get_down_recv_size( unsigned long long* val ){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        *val = vs->get_down_recv_size();
+
+    }
+    void        get_down_send_size( unsigned long long* val ){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        *val = vs->get_down_send_size();
+
+    }
+
+    void        update_up_recv_size( unsigned long long size ){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        vs->update_up_recv_size( size );
+
+    }
+    void        update_up_send_size( unsigned long long size ){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        vs->update_up_send_size( size );
+
+    }
+    void        update_down_recv_size( unsigned long long size ){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        vs->update_down_recv_size( size );
+
+    }
+    void        update_down_send_size( unsigned long long size ){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        vs->update_down_send_size( size );
+
+    }
+
+    void        get_protocol_module( l7vs::protocol_module_base* in_pm ){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        in_pm = vs->get_protocol_module();
+
+    }
+    void        get_schedule_module( l7vs::schedule_module_base* in_sm ){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        in_sm = vs->get_schedule_module();
+
+    }
+
+    void        vs_initialize(){
+        l7vs::error_code    vs_err;
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        vs->initialize( vs_err );
+
+    }
+    void        vs_finalize(){
+        l7vs::error_code    vs_err;
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        vs->finalize( vs_err );
+
+        BOOST_MESSAGE( "finalize." << boost::this_thread::get_id() );
+    }
+
+    void        vs_eq( const l7vs::virtualservice_base* in_vs, bool* ret ){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        *ret = vs->operator==(*in_vs);
+
+    }
+    void        vs_ne( const l7vs::virtualservice_base* in_vs, bool* ret ){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        *ret = vs->operator!=(*in_vs);
+
+    }
+
+    void        set_virtualservice( const l7vs::virtualservice_element& elem ){
+        l7vs::error_code    vs_err;
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        vs->set_virtualservice( elem, vs_err );
+
+    }
+    void        edit_virtualservice( const l7vs::virtualservice_element& elem ){
+        l7vs::error_code    vs_err;
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        vs->edit_virtualservice( elem, vs_err );
+
+    }
+
+    void        add_realserver( const l7vs::virtualservice_element& elem ){
+        l7vs::error_code    vs_err;
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        vs->add_realserver( elem, vs_err );
+
+    }
+    void        edit_realserver( const l7vs::virtualservice_element& elem ){
+        l7vs::error_code    vs_err;
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        vs->edit_realserver( elem, vs_err );
+
+    }
+    void        del_realserver( const l7vs::virtualservice_element& elem ){
+        l7vs::error_code    vs_err;
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        vs->del_realserver( elem, vs_err );
+
+    }
+
+    void        run(){
+        vs->run();
+    }
+    void        stop(){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        vs->stop();
+
+    }
+
+    void        connection_active( const tcp_ep_type& ep ){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        vs->connection_active( ep );
+
+    }
+    void        connection_inactive( const tcp_ep_type& ep ){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        vs->connection_inactive( ep );
+
+    }
+    void        release_session( const l7vs::tcp_session* session_ptr ){
+        boost::mutex    mtx;
+        boost::mutex::scoped_lock    lk( mtx );
+        cond.wait( lk );
+
+        vs->release_session( session_ptr );
+    }
+};
+
+void    virtualservice_tcp_test2_1(){
+    counter = 1;
+    //replicationエリアを作成しておく
+    debugg_flug_struct::getInstance().create_rep_area();
+
+    boost::asio::io_service        dispatcher;
+
+    l7vs::l7vsd                    vsd;
+    l7vs::replication            rep();
+
+    debugg_flug_struct::getInstance().pmcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().smcontrol_err_flag()    = false;
+    debugg_flug_struct::getInstance().param_exist_flag() = false;
+
+    l7vs::error_code            vs_err;
+    boost::system::error_code    test_err;
+
+    std::stringstream    tmp_tcp_ep;
+    std::stringstream    tmp_udp_ep;
+    std::stringstream    tmp_sorry_ep;
+
+    l7vs::virtualservice_element    elem1;
+
+    //set element value
+    elem1.udpmode                    = false;
+    elem1.tcp_accept_endpoint        = 
+            tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem1.udp_recv_endpoint            = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem1.realserver_vector.clear();
+    elem1.protocol_module_name        = "PMtest1";
+    elem1.schedule_module_name        = "SMtest1";
+    elem1.protocol_args.clear();
+    elem1.sorry_maxconnection        = 1234LL;
+    elem1.sorry_endpoint            = tcp_ep_type();
+    elem1.sorry_flag                = false;
+    elem1.qos_upstream                = 65535ULL;
+    elem1.qos_downstream            = 32767ULL;
+
+    //vs作成
+    vs_access    vst;
+    vst.initialize( elem1 );
+
+    //rs追加
+    // unit_test[27]  add_rsとrs_list_lock
+    std::cout << counter++ << std::endl;
+    //RS追加用のelement準備
+    l7vs::virtualservice_element    elem2;
+    //set element value
+    elem2.udpmode                    = false;
+    elem2.tcp_accept_endpoint        = 
+            tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem2.udp_recv_endpoint            = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem2.realserver_vector.clear();
+    elem2.protocol_module_name        = "PMtest1";
+    elem2.schedule_module_name        = "SMtest1";
+    elem2.protocol_args.clear();
+    elem2.sorry_maxconnection        = 1234LL;
+    elem2.sorry_endpoint            = tcp_ep_type();
+    elem2.sorry_flag                = false;
+    elem2.qos_upstream                = 65535ULL;
+    elem2.qos_downstream            = 32767ULL;
+    for( size_t i = 0; i < 2; ++i ){
+        l7vs::realserver_element    rs_elem;
+        rs_elem.tcp_endpoint = tcp_ep_type( boost::asio::ip::address::from_string( "192.168.10.10" ), (i+8080) );
+        rs_elem.weight    = 10+i;
+        elem2.realserver_vector.push_back( rs_elem );
+    }
+    {
+        boost::thread    thread1( &vs_access::rs_list_lock, &vst );
+        boost::thread    thread2( &vs_access::add_realserver, &vst, elem2 );
+
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+        BOOST_CHECK( vst.get_vs()->get_ref_count() == 1 );
+        //ref_countが1のままだとadd_realserverができないのでunlockする
+        vst.get_vs()->rs_list_unlock();
+        usleep( 100000 );
+         thread1.join();
+         thread2.join();
+    }
+    BOOST_CHECK( vst.get_vs()->get_rs_list().size() == 2 );
+    BOOST_CHECK( vst.get_vs()->get_ref_count() == 0 );
+
+    //一旦削除
+    vst.get_vs()->del_realserver( elem2, vs_err );
+
+    // unit_test[28]  add_rsとrs_list_unlock(ref_countが1でスタートした場合)
+    std::cout << counter++ << std::endl;
+    {
+        //あらかじめlockしておいてref_countを1にしておく
+        vst.get_vs()->rs_list_lock();
+        BOOST_CHECK( vst.get_vs()->get_ref_count() == 1 );
+
+        boost::thread    thread1( &vs_access::add_realserver, &vst, elem2 );
+        boost::thread    thread2( &vs_access::rs_list_unlock, &vst );
+
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+        thread1.join();
+        thread2.join();
+    }
+    BOOST_CHECK( vst.get_vs()->get_rs_list().size() == 2 );
+    BOOST_CHECK( vst.get_vs()->get_ref_count() == 0 );
+
+    // unit_test[29]  add_rsとconnection_active
+    std::cout << counter++ << std::endl;
+    //RS追加用のelement準備
+    l7vs::virtualservice_element    elem3;
+    //set element value
+    elem3.udpmode                    = false;
+    elem3.tcp_accept_endpoint        = 
+            tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem3.udp_recv_endpoint            = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem3.realserver_vector.clear();
+    elem3.protocol_module_name        = "PMtest1";
+    elem3.schedule_module_name        = "SMtest1";
+    elem3.protocol_args.clear();
+    elem3.sorry_maxconnection        = 1234LL;
+    elem3.sorry_endpoint            = tcp_ep_type();
+    elem3.sorry_flag                = false;
+    elem3.qos_upstream                = 65535ULL;
+    elem3.qos_downstream            = 32767ULL;
+    for( size_t i = 0; i < 2; ++i ){
+        l7vs::realserver_element    rs_elem;
+        rs_elem.tcp_endpoint = tcp_ep_type( boost::asio::ip::address::from_string( "192.168.10.10" ), (i+8090) );
+        rs_elem.weight    = 5+i;
+        elem3.realserver_vector.push_back( rs_elem );
+    }
+    {
+        boost::thread    thread1( &vs_access::add_realserver, &vst, elem3 );
+        boost::thread    thread2( &vs_access::connection_active, &vst, elem2.realserver_vector[0].tcp_endpoint );
+
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+
+        thread1.join();
+        thread2.join();
+    }
+    BOOST_CHECK( vst.get_vs()->get_rs_list().size() == 4 );
+    for( std::list<l7vs::realserver>::iterator itr = vst.get_vs()->get_rs_list().begin();
+         itr != vst.get_vs()->get_rs_list().end(); ++itr ){
+        if( itr->tcp_endpoint == elem2.realserver_vector[0].tcp_endpoint ){
+            std::cout << "active_conn check" << std::endl;
+            BOOST_CHECK( itr->get_active() == 1 );
+            BOOST_CHECK( itr->get_inact() == 0 );
+            break;
+        }
+    }
+
+    //一旦削除
+    vst.get_vs()->del_realserver( elem3, vs_err );
+
+    // unit_test[30]  add_rsとconnection_inactive
+    std::cout << counter++ << std::endl;
+    {
+        boost::thread    thread1( &vs_access::add_realserver, &vst, elem3 );
+        boost::thread    thread2( &vs_access::connection_inactive, &vst, elem2.realserver_vector[0].tcp_endpoint );
+
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+
+        thread1.join();
+        thread2.join();
+    }
+    BOOST_CHECK( vst.get_vs()->get_rs_list().size() == 4 );
+    for( std::list<l7vs::realserver>::iterator itr = vst.get_vs()->get_rs_list().begin();
+         itr != vst.get_vs()->get_rs_list().end(); ++itr ){
+        if( itr->tcp_endpoint == elem2.realserver_vector[0].tcp_endpoint ){
+            std::cout << "inactive_conn check" << std::endl;
+            BOOST_CHECK( itr->get_active() == 0 );
+            BOOST_CHECK( itr->get_inact() == 1 );
+            break;
+        }
+    }
+
+    //rs変更
+    // unit_test[31]  edit_rsとrs_list_lock
+    std::cout << counter++ << std::endl;
+    //RS編集用のelement準備
+    l7vs::virtualservice_element    elem4;
+    //set element value
+    elem4.udpmode                    = false;
+    elem4.tcp_accept_endpoint        = 
+            tcp_ep_type( boost::asio::ip::address_v4::loopback(), (60000) );
+    elem4.udp_recv_endpoint            = udp_ep_type( boost::asio::ip::address::from_string( "10.144.169.20" ), (50000) );
+    elem4.realserver_vector.clear();
+    elem4.protocol_module_name        = "PMtest1";
+    elem4.schedule_module_name        = "SMtest1";
+    elem4.protocol_args.clear();
+    elem4.sorry_maxconnection        = 1234LL;
+    elem4.sorry_endpoint            = tcp_ep_type();
+    elem4.sorry_flag                = false;
+    elem4.qos_upstream                = 65535ULL;
+    elem4.qos_downstream            = 32767ULL;
+    for( size_t i = 0; i < 2; ++i ){
+        l7vs::realserver_element    rs_elem;
+        rs_elem.tcp_endpoint = tcp_ep_type( boost::asio::ip::address::from_string( "192.168.10.10" ), (i+8080) );
+        rs_elem.weight    = 5+i;
+        elem4.realserver_vector.push_back( rs_elem );
+    }
+    {
+        boost::thread    thread1( &vs_access::edit_realserver, &vst, elem4 );
+        boost::thread    thread2( &vs_access::rs_list_lock, &vst );
+
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+        BOOST_CHECK( vst.get_vs()->get_ref_count() == 1 );
+        //ref_countが1のままだとedit_realserverができないのでunlockする
+        vst.get_vs()->rs_list_unlock();
+        BOOST_CHECK( vst.get_vs()->get_ref_count() == 0 );
+        usleep( 100000 );
+        thread1.join();
+        thread2.join();
+    }
+    BOOST_CHECK( vst.get_vs()->get_rs_list().size() == 4 );
+
+    // unit_test[32]  edit_rsとrs_list_unlock
+    std::cout << counter++ << std::endl;
+    {
+        //あらかじめlockしておいてref_countを1にしておく
+        vst.get_vs()->rs_list_lock();
+        BOOST_CHECK( vst.get_vs()->get_ref_count() == 1 );
+
+        boost::thread    thread1( &vs_access::edit_realserver, &vst, elem2 );
+        boost::thread    thread2( &vs_access::rs_list_unlock, &vst );
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+        thread1.join();
+        thread2.join();
+    }
+    BOOST_CHECK( vst.get_vs()->get_rs_list().size() == 4 );
+    BOOST_CHECK( vst.get_vs()->get_ref_count() == 0 );
+
+    // unit_test[33]  edit_rsとconnection_active
+    std::cout << counter++ << std::endl;
+    elem4.realserver_vector.clear();
+    for( size_t i = 0; i < 2; ++i ){
+        l7vs::realserver_element    rs_elem;
+        rs_elem.tcp_endpoint = tcp_ep_type( boost::asio::ip::address::from_string( "192.168.10.10" ), (i+8080) );
+        rs_elem.weight    = 100+i;
+        elem4.realserver_vector.push_back( rs_elem );
+    }
+    {
+        boost::thread    thread1( &vs_access::edit_realserver, &vst, elem4 );
+        boost::thread    thread2( &vs_access::connection_active, &vst, elem2.realserver_vector[0].tcp_endpoint );
+
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+
+        thread1.join();
+        thread2.join();
+    }
+    BOOST_CHECK( vst.get_vs()->get_rs_list().size() == 4 );
+    for( std::list<l7vs::realserver>::iterator itr = vst.get_vs()->get_rs_list().begin();
+         itr != vst.get_vs()->get_rs_list().end(); ++itr ){
+        if( itr->tcp_endpoint == elem2.realserver_vector[0].tcp_endpoint ){
+            std::cout << "active_conn check" << std::endl;
+            BOOST_CHECK( itr->get_active() == 1 );
+            BOOST_CHECK( itr->get_inact() == 1 );
+            break;
+        }
+    }
+    // unit_test[34]  edit_rsとconnection_inactive
+    std::cout << counter++ << std::endl;
+    {
+        boost::thread    thread1( &vs_access::edit_realserver, &vst, elem4 );
+        boost::thread    thread2( &vs_access::connection_inactive, &vst, elem2.realserver_vector[0].tcp_endpoint );
+
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+
+        thread1.join();
+        thread2.join();
+    }
+    BOOST_CHECK( vst.get_vs()->get_rs_list().size() == 4 );
+    for( std::list<l7vs::realserver>::iterator itr = vst.get_vs()->get_rs_list().begin();
+         itr != vst.get_vs()->get_rs_list().end(); ++itr ){
+        if( itr->tcp_endpoint == elem2.realserver_vector[0].tcp_endpoint ){
+            std::cout << "inactive_conn check" << std::endl;
+            BOOST_CHECK( itr->get_active() == 0 );
+            BOOST_CHECK( itr->get_inact() == 2 );
+            break;
+        }
+    }
+
+    //rs削除
+    // unit_test[35]  del_rsとrs_list_lock
+    std::cout << counter++ << std::endl;
+    {
+        boost::thread    thread1( &vs_access::del_realserver, &vst, elem4 );
+        boost::thread    thread2( &vs_access::rs_list_lock, &vst );
+
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+        BOOST_CHECK( vst.get_vs()->get_ref_count() == 1 );
+        //ref_countが1のままだとedit_realserverができないのでunlockする
+        vst.get_vs()->rs_list_unlock();
+        BOOST_CHECK( vst.get_vs()->get_ref_count() == 0 );
+        usleep( 100000 );
+        thread1.join();
+        thread2.join();
+    }
+    BOOST_CHECK( vst.get_vs()->get_rs_list().size() == 2 );
+
+    //再度追加
+    vst.get_vs()->add_realserver( elem4, vs_err );
+
+    // unit_test[36]  del_rsとrs_list_unlock
+    std::cout << counter++ << std::endl;
+    {
+        //あらかじめlockしておいてref_countを1にしておく
+        vst.get_vs()->rs_list_lock();
+        BOOST_CHECK( vst.get_vs()->get_ref_count() == 1 );
+
+        boost::thread    thread1( &vs_access::del_realserver, &vst, elem4 );
+        boost::thread    thread2( &vs_access::rs_list_unlock, &vst );
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+        thread1.join();
+        thread2.join();
+    }
+    BOOST_CHECK( vst.get_vs()->get_rs_list().size() == 2 );
+    BOOST_CHECK( vst.get_vs()->get_ref_count() == 0 );
+
+    //再度追加
+    vst.get_vs()->add_realserver( elem4, vs_err );
+
+    //del_rsとconnection_active
+    {
+        boost::thread    thread1( &vs_access::del_realserver, &vst, elem4 );
+        boost::thread    thread2( &vs_access::connection_active, &vst, elem3.realserver_vector[0].tcp_endpoint );
+
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+
+        thread1.join();
+        thread2.join();
+    }
+    BOOST_CHECK( vst.get_vs()->get_rs_list().size() == 2 );
+    for( std::list<l7vs::realserver>::iterator itr = vst.get_vs()->get_rs_list().begin();
+         itr != vst.get_vs()->get_rs_list().end(); ++itr ){
+        if( itr->tcp_endpoint == elem2.realserver_vector[0].tcp_endpoint ){
+            std::cout << "active_conn check" << std::endl;
+            BOOST_CHECK( itr->get_active() == 1 );
+            BOOST_CHECK( itr->get_inact() == 0 );
+            break;
+        }
+    }
+
+    //再度追加
+    vst.get_vs()->add_realserver( elem4, vs_err );
+    //del_rsとconnection_inactive
+    {
+        boost::thread    thread1( &vs_access::del_realserver, &vst, elem4 );
+        boost::thread    thread2( &vs_access::connection_inactive, &vst, elem3.realserver_vector[0].tcp_endpoint );
+
+        usleep( 100000 );
+        vst.start();
+        usleep( 1000 );
+
+        thread1.join();
+        thread2.join();
+    }
+    BOOST_CHECK( vst.get_vs()->get_rs_list().size() == 2 );
+    for( std::list<l7vs::realserver>::iterator itr = vst.get_vs()->get_rs_list().begin();
+         itr != vst.get_vs()->get_rs_list().end(); ++itr ){
+        if( itr->tcp_endpoint == elem2.realserver_vector[0].tcp_endpoint ){
+            std::cout << "inactive_conn check" << std::endl;
+            BOOST_CHECK( itr->get_active() == 0 );
+            BOOST_CHECK( itr->get_inact() == 1 );
+            break;
+        }
+    }
+
+    vst.finalize();
+    //replicationエリアを開放する
+    debugg_flug_struct::getInstance().destroy_rep_area();
+}
+
+
+test_suite*    init_unit_test_suite( int argc, char* argv[] ){
+
+    // create unit test suite
+    test_suite* ts = BOOST_TEST_SUITE( "virtualservice_base_test" );
+
+    // add test case to test suite
+    ts->add( BOOST_TEST_CASE( &virtualservice_tcp_test2_1 ) );
+
+    framework::master_test_suite().add( ts );
+
+    return 0;
+}
diff --git a/l7vsd/unit_tests/virtualservice_test/vs_test.h b/l7vsd/unit_tests/virtualservice_test/vs_test.h
new file mode 100644 (file)
index 0000000..21c650d
--- /dev/null
@@ -0,0 +1,146 @@
+#ifndef VS_TEST
+#define VS_TEST
+
+#include <boost/serialization/list.hpp>
+#include "./parameter_stub/parameter.h"
+#include "virtualservice.h"
+#include "protocol_module_control.h"
+#include "schedule_module_control.h"
+
+namespace l7vs{
+
+class    vs_test : public virtualservice_base {
+protected:
+    boost::xtime    diffelencial_time;
+    void    handle_replication_interrupt( const boost::system::error_code& err ){
+    }
+    void    read_replicationdata(){
+    }
+
+public:
+    vs_test(    const l7vsd& in_vsd,
+                const replication& in_rep,
+                const virtualservice_element& in_el ) : virtualservice_base( in_vsd, in_rep, in_el ){
+    }
+    ~vs_test(){};
+
+    void    initialize( error_code& err ){
+        protomod = protocol_module_control::getInstance().load_module( "PMtest1" );
+        schedmod = schedule_module_control::getInstance().load_module( "SMtest1" );
+    }
+    void    finalize( error_code& err ){
+    }
+
+    bool    operator==( const virtualservice_base& vs ){
+        return true;
+    }
+    bool    operator!=( const virtualservice_base& vs ){
+        return true;
+    }
+
+    void    set_virtualservice( const virtualservice_element& el, error_code& err ){
+    }
+    void    edit_virtualservice( const virtualservice_element& el, error_code& err ){
+    }
+
+    void    add_realserver( const virtualservice_element& el, error_code& err ){
+    }
+    void    edit_realserver( const virtualservice_element& el, error_code& err ){
+    }
+    void    del_realserver( const virtualservice_element& el, error_code& err ){
+    }
+
+    void    run(){
+    }
+    void    stop(){
+    }
+
+    void    connection_active( const boost::asio::ip::tcp::endpoint& ep ){
+    }
+    void    connection_inactive( const boost::asio::ip::tcp::endpoint& ep ){
+    }
+    void    release_session( const tcp_session* session_ptr ){
+    }
+
+    //imprement for unit_test
+    const l7vsd&        get_vsd(){ return vsd; }
+    const replication&    get_rep(){ return rep; }
+
+    void    call_handle_protomod_replication( const boost::system::error_code& err ){
+        handle_protomod_replication( err );
+    }
+    void    call_handle_schedmod_replication( const boost::system::error_code& err ){
+        handle_schedmod_replication( err );
+    }
+
+    unsigned long long    get_refcount(){
+        return rs_list_ref_count.get();
+//         return rs_list_ref_count;
+    }
+    void                set_refcount( unsigned long long in ){
+        rs_list_ref_count = in;
+    }
+
+    unsigned long long    get_curr_up_recv_size(){
+        return current_up_recvsize.get();
+//         return current_up_recvsize;
+    }
+    unsigned long long    get_curr_down_recv_size(){
+        return current_down_recvsize.get();
+//         return current_down_recvsize;
+    }
+    void    call_handle_throughput_update( const boost::system::error_code& err ){
+        boost::xtime_get( &diffelencial_time, boost::TIME_UTC );
+        handle_throughput_update( err );
+
+        if( 0 < diffelencial_time.sec ){
+            std::cout << diffelencial_time.sec << "[sec]" << std::endl;
+        }else{
+            std::cout << diffelencial_time.nsec << "[nsec]" << std::endl;
+        }
+    }
+    void    test_replication(){
+/*        //serialize出力(header&data)
+        virtualservice_base::replication_data    a1;
+        //set data
+        a1.udpflag        = true;
+        a1.tcp_endpoint    = boost::asio::ip::tcp::endpoint( boost::asio::ip::address::from_string( "192.168.10.10" ), 8080 );
+        a1.udp_endpoint    = boost::asio::ip::udp::endpoint( boost::asio::ip::address::from_string( "192.168.10.20" ), 8080 );
+        a1.sorry_maxconnection    = LLONG_MAX;
+        a1.sorry_endpoint        = boost::asio::ip::tcp::endpoint( boost::asio::ip::address::from_string( "192.168.10.1" ), 80 );
+        a1.sorry_flag            = true;
+        a1.qos_up                = 0ULL;
+        a1.qos_down                = 30ULL;
+
+        std::stringstream    ss;
+        boost::archive::text_oarchive    oa( ss );
+        oa << (const l7vs::virtualservice_base::replication_data&)a1;
+
+        std::cout << ss.str() << std::endl;
+        std::cout << ss.str().size() << std::endl;
+
+        //serialize入力
+        boost::archive::text_iarchive    ia( ss );
+        l7vs::virtualservice_base::replication_data    a2;
+        ia >> a2;
+        BOOST_CHECK( a2.udpflag == a1.udpflag );
+        BOOST_CHECK( a2.tcp_endpoint == a1.tcp_endpoint );
+        BOOST_CHECK( a2.udp_endpoint == a1.udp_endpoint );
+        BOOST_CHECK( a2.sorry_maxconnection == a1.sorry_maxconnection );
+        BOOST_CHECK( a2.sorry_endpoint == a1.sorry_endpoint );
+        BOOST_CHECK( a2.sorry_flag == a1.sorry_flag );
+        BOOST_CHECK( a2.qos_up == a1.qos_up );
+        BOOST_CHECK( a2.qos_down == a1.qos_down );*/
+    }
+    parameter_data&    get_param_data(){
+        return param_data;
+    }
+    void    call_load_parameter(){
+        l7vs::error_code    err;
+        load_parameter( err );
+    }
+};
+
+}
+
+#endif