diff --git a/libtestutils/BlockChainLoader.h b/libtestutils/BlockChainLoader.h
index a3528045c..ed110ff6f 100644
--- a/libtestutils/BlockChainLoader.h
+++ b/libtestutils/BlockChainLoader.h
@@ -32,7 +32,8 @@ namespace test
{
/**
- * @brief - loads the blockchain from json, creates temporary directory to store it, removes this temporary directory on dealloc
+ * @brief Should be used to load test blockchain from json file
+ * Loads the blockchain from json, creates temporary directory to store it, removes the directory on dealloc
*/
class BlockChainLoader
{
diff --git a/libtestutils/CMakeLists.txt b/libtestutils/CMakeLists.txt
index f79daa47c..202b9823c 100644
--- a/libtestutils/CMakeLists.txt
+++ b/libtestutils/CMakeLists.txt
@@ -11,9 +11,7 @@ aux_source_directory(. SRC_LIST)
include_directories(BEFORE ${JSONCPP_INCLUDE_DIRS})
include_directories(BEFORE ..)
-include_directories(${MHD_INCLUDE_DIRS})
include_directories(${JSON_RPC_CPP_INCLUDE_DIRS})
-include_directories(${LEVELDB_INCLUDE_DIRS})
include_directories(${Boost_INCLUDE_DIRS})
set(EXECUTABLE testutils)
@@ -26,18 +24,10 @@ else()
add_library(${EXECUTABLE} SHARED ${SRC_LIST} ${HEADERS})
endif()
-target_link_libraries(${EXECUTABLE} ${LEVELDB_LIBRARIES})
+target_link_libraries(${EXECUTABLE} ${Boost_FILESYSTEM_LIBRARIES})
target_link_libraries(${EXECUTABLE} ${JSONCPP_LIBRARIES})
-target_link_libraries(${EXECUTABLE} ${JSON_RPC_CPP_SERVER_LIBRARIES})
-target_link_libraries(${EXECUTABLE} ${MHD_LIBRARIES})
-
-target_link_libraries(${EXECUTABLE} webthree)
-target_link_libraries(${EXECUTABLE} secp256k1)
-target_link_libraries(${EXECUTABLE} solidity)
-
-if (NOT ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC"))
- target_link_libraries(${EXECUTABLE} serpent)
-endif()
+target_link_libraries(${EXECUTABLE} ethereum)
+target_link_libraries(${EXECUTABLE} web3jsonrpc)
install( TARGETS ${EXECUTABLE} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib )
install( FILES ${HEADERS} DESTINATION include/${EXECUTABLE} )
diff --git a/libtestutils/FixedClient.h b/libtestutils/FixedClient.h
index ce628c651..f0a7c54f6 100644
--- a/libtestutils/FixedClient.h
+++ b/libtestutils/FixedClient.h
@@ -30,6 +30,10 @@ namespace dev
namespace test
{
+/**
+ * @brief mvp implementation of ClientBase
+ * Doesn't support mining interface
+ */
class FixedClient: public dev::eth::ClientBase
{
public:
diff --git a/libtestutils/FixedWebThreeServer.cpp b/libtestutils/FixedWebThreeServer.cpp
index 6a1b13b11..c72a106c6 100644
--- a/libtestutils/FixedWebThreeServer.cpp
+++ b/libtestutils/FixedWebThreeServer.cpp
@@ -1,2 +1,22 @@
+/*
+ This file is part of cpp-ethereum.
+
+ cpp-ethereum is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ cpp-ethereum 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with cpp-ethereum. If not, see .
+ */
+/** @file FixedWebThreeStubServer.cpp
+ * @author Marek Kotewicz
+ * @date 2015
+ */
#include "FixedWebThreeServer.h"
diff --git a/libtestutils/FixedWebThreeServer.h b/libtestutils/FixedWebThreeServer.h
index aab12c461..33ccbf71e 100644
--- a/libtestutils/FixedWebThreeServer.h
+++ b/libtestutils/FixedWebThreeServer.h
@@ -1,10 +1,35 @@
+/*
+ This file is part of cpp-ethereum.
+ cpp-ethereum is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ cpp-ethereum 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with cpp-ethereum. If not, see .
+ */
+/** @file FixedWebThreeStubServer.h
+ * @author Marek Kotewicz
+ * @date 2015
+ */
#pragma once
#include
#include
+/**
+ * @brief dummy JSON-RPC api implementation
+ * Should be used for test purposes only
+ * Supports eth && db interfaces
+ * Doesn't support shh && net interfaces
+ */
class FixedWebThreeServer: public dev::WebThreeStubServerBase, public dev::WebThreeStubDatabaseFace
{
public:
diff --git a/libtestutils/ShortLivingDirectory.cpp b/libtestutils/ShortLivingDirectory.cpp
index 56fc101a7..48e1d643d 100644
--- a/libtestutils/ShortLivingDirectory.cpp
+++ b/libtestutils/ShortLivingDirectory.cpp
@@ -20,21 +20,20 @@
*/
#include
+#include
#include "ShortLivingDirectory.h"
-#include "Common.h"
using namespace std;
using namespace dev;
using namespace dev::test;
-ShortLivingDirectory::ShortLivingDirectory()
-{
- m_path = getRandomPath();
- boost::filesystem::create_directories(m_path);
-}
-
ShortLivingDirectory::ShortLivingDirectory(std::string const& _path) : m_path(_path)
{
+ // we never ever want to delete a directory (including all its contents) that we did not create ourselves.
+ if (boost::filesystem::exists(m_path)) {
+ BOOST_THROW_EXCEPTION(FileError());
+ }
+
boost::filesystem::create_directories(m_path);
}
diff --git a/libtestutils/ShortLivingDirectory.h b/libtestutils/ShortLivingDirectory.h
index 6f572c2bc..bab6a1c20 100644
--- a/libtestutils/ShortLivingDirectory.h
+++ b/libtestutils/ShortLivingDirectory.h
@@ -22,20 +22,25 @@
#pragma once
#include
+#include "Common.h"
namespace dev
{
namespace test
{
+/**
+ * @brief temporary directory implementation
+ * It creates temporary directory in the given path. On dealloc it removes the directory
+ * @throws if the given path already exists, throws an exception
+ */
class ShortLivingDirectory
{
public:
- ShortLivingDirectory();
- ShortLivingDirectory(std::string const& _path);
+ ShortLivingDirectory(std::string const& _path = getRandomPath());
~ShortLivingDirectory();
- std::string path(){ return m_path; }
+ std::string const& path() { return m_path; }
private:
std::string m_path;
diff --git a/libtestutils/StateLoader.cpp b/libtestutils/StateLoader.cpp
index 0561e40f1..b56475b5a 100644
--- a/libtestutils/StateLoader.cpp
+++ b/libtestutils/StateLoader.cpp
@@ -26,8 +26,7 @@ using namespace dev;
using namespace dev::eth;
using namespace dev::test;
-StateLoader::StateLoader(Json::Value const& _json)
-: m_state(Address(), OverlayDB(), BaseState::Empty)
+StateLoader::StateLoader(Json::Value const& _json) : m_state(Address(), OverlayDB(), BaseState::Empty)
{
for (string const& name: _json.getMemberNames())
{
diff --git a/libtestutils/StateLoader.h b/libtestutils/StateLoader.h
index 90f806714..e8f955440 100644
--- a/libtestutils/StateLoader.h
+++ b/libtestutils/StateLoader.h
@@ -29,11 +29,14 @@ namespace dev
namespace test
{
+/**
+ * @brief Friend of State, loads State from given JSON object
+ */
class StateLoader
{
public:
StateLoader(Json::Value const& _json);
- eth::State state() { return m_state; }
+ eth::State const& state() { return m_state; }
private:
eth::State m_state;