diff options
| author | arcadia-devtools <[email protected]> | 2022-02-11 19:15:32 +0300 | 
|---|---|---|
| committer | arcadia-devtools <[email protected]> | 2022-02-11 19:15:32 +0300 | 
| commit | 623b75523fbec13f26b532972a46e75faf149088 (patch) | |
| tree | ce04a52fd058b3017037ecc4a843a39c2a829575 /library/cpp/messagebus | |
| parent | 4f5398551111a2b05b55de391d5d296bd0a670bf (diff) | |
intermediate changes
ref:ee911405f4248489c0aa2817134b7162e0b94f18
Diffstat (limited to 'library/cpp/messagebus')
| -rw-r--r-- | library/cpp/messagebus/test/ut/www_ut.cpp | 19 | ||||
| -rw-r--r-- | library/cpp/messagebus/test/ut/ya.make | 2 | ||||
| -rw-r--r-- | library/cpp/messagebus/www/www.cpp | 16 | ||||
| -rw-r--r-- | library/cpp/messagebus/www/ya.make | 9 | 
4 files changed, 27 insertions, 19 deletions
diff --git a/library/cpp/messagebus/test/ut/www_ut.cpp b/library/cpp/messagebus/test/ut/www_ut.cpp new file mode 100644 index 00000000000..181984db473 --- /dev/null +++ b/library/cpp/messagebus/test/ut/www_ut.cpp @@ -0,0 +1,19 @@ +#include <library/cpp/testing/unittest/registar.h> +#include <library/cpp/resource/resource.h> + +Y_UNIT_TEST_SUITE(Www) { +    Y_UNIT_TEST(messagebus_js) { +       auto str = NResource::Find("/messagebus.js"); +       UNIT_ASSERT(str.Contains("logTransform")); +       UNIT_ASSERT(str.Contains("plotHist")); +    } + +    Y_UNIT_TEST(busico_png) { +       auto str = NResource::Find("/bus-ico.png"); +       UNIT_ASSERT(str.Contains("PNG")); //header +    } + +    Y_UNIT_TEST(not_exist) { +       UNIT_ASSERT_EXCEPTION(NResource::Find("/not_exist"), yexception); +    } +} diff --git a/library/cpp/messagebus/test/ut/ya.make b/library/cpp/messagebus/test/ut/ya.make index fe1b4961d69..bf15564d95e 100644 --- a/library/cpp/messagebus/test/ut/ya.make +++ b/library/cpp/messagebus/test/ut/ya.make @@ -18,6 +18,7 @@ PEERDIR(      library/cpp/messagebus      library/cpp/messagebus/test/helper      library/cpp/messagebus/www +    library/cpp/resource  )  SRCS( @@ -29,6 +30,7 @@ SRCS(      starter_ut.cpp      sync_client_ut.cpp      locator_uniq_ut.cpp +    www_ut.cpp      ../../actor/actor_ut.cpp      ../../actor/ring_buffer_ut.cpp      ../../actor/tasks_ut.cpp diff --git a/library/cpp/messagebus/www/www.cpp b/library/cpp/messagebus/www/www.cpp index 62ec241d852..6c8b4bc732f 100644 --- a/library/cpp/messagebus/www/www.cpp +++ b/library/cpp/messagebus/www/www.cpp @@ -6,11 +6,11 @@  #include <library/cpp/messagebus/remote_connection_status.h>  #include <library/cpp/monlib/deprecated/json/writer.h> -#include <library/cpp/archive/yarchive.h>  #include <library/cpp/http/fetch/httpfsm.h>  #include <library/cpp/http/fetch/httpheader.h>  #include <library/cpp/http/server/http.h>  #include <library/cpp/json/writer/json.h> +#include <library/cpp/resource/resource.h>  #include <library/cpp/uri/http_url.h>  #include <util/string/cast.h> @@ -165,18 +165,6 @@ namespace {  } -const unsigned char WWW_STATIC_DATA[] = { -#include "www_static.inc" -}; - -class TWwwStaticLoader: public TArchiveReader { -public: -    TWwwStaticLoader() -        : TArchiveReader(TBlob::NoCopy(WWW_STATIC_DATA, sizeof(WWW_STATIC_DATA))) -    { -    } -}; -  struct TBusWww::TImpl {      // TODO: use weak pointers      TNamedValues<TBusMessageQueuePtr> Queues; @@ -728,7 +716,7 @@ struct TBusWww::TImpl {              } else {                  os << HTTP_OK_BIN;              } -            TBlob blob = Singleton<TWwwStaticLoader>()->ObjectBlobByKey(TString("/") + TString(path)); +            auto blob = NResource::Find(TString("/") + TString(path));              os.Write(blob.Data(), blob.Size());          } diff --git a/library/cpp/messagebus/www/ya.make b/library/cpp/messagebus/www/ya.make index 972390cea3f..b0488bf0ef1 100644 --- a/library/cpp/messagebus/www/ya.make +++ b/library/cpp/messagebus/www/ya.make @@ -7,14 +7,13 @@ SRCS(      www.cpp  ) -ARCHIVE( -    NAME www_static.inc -    messagebus.js -    bus-ico.png +RESOURCE( +    messagebus.js /messagebus.js +    bus-ico.png /bus-ico.png  )  PEERDIR( -    library/cpp/archive +    library/cpp/resource      library/cpp/cgiparam      library/cpp/html/pcdata      library/cpp/http/fetch  | 
