singleton-ruby 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 02dddde67fa3b757131fb35d2902a4bd5b9d5337c137cf5c1d88e0183682ce31
4
- data.tar.gz: ad71c6cc7c04808dfea6b0685c3cc56e139b3af1818e04effdda4513ac2e1e50
3
+ metadata.gz: 2eafb488acb5e9534e211a2757110e9768841fa62c6e49fc791b2751a7e3cc70
4
+ data.tar.gz: cd8aa70499702d69ce4a8d5f936fd4ac6b41bc5500283e2514135cb5e9f10b77
5
5
  SHA512:
6
- metadata.gz: 238440d4e04e2dd08673e3ba5c7122afe5fc8c92e3e4bfa864ac0c7b6f5c4e34bc5b1f33afaaa3e502f2552a40ccb0f301aff8425cc4003c6d26ac9484116691
7
- data.tar.gz: 75a9bafa92d9dc4cc280935a29edd86c3c678b858df52c0b24cdf5328e91d8514705fc7f20891c87758c87615b8f8f7547755c337eeef13564088d29a5126b89
6
+ metadata.gz: 39a6c18b36bd1850962a17517811589b1e3a16b7949980be4f0839bc4bbcc7e02025b1d4d0929dc6f18e2126fa77926bd374ad65dc48ab90c36c51bbea0da666
7
+ data.tar.gz: cfb42233c159ffd9639dccfc73e953f43943c964702f7e0742fbb1fe3da078bfbffb6aee21123c1629810d13731b7dbe414e250c56deb2afad1b4a69e79aeb56
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Singeleton client for Ruby
2
2
 
3
3
  ## Prerequisites
4
- - Ruby 3.0.0 or above
5
- - Bundler 2.2.3 or above
4
+ - Ruby version: 3.0.0 or above
5
+ - Bundler version: 2.2.3 or above
6
+
7
+
6
8
 
data/lib/sgtn-client.rb CHANGED
@@ -1,8 +1,9 @@
1
1
  module SgtnClient
2
2
 
3
- autoload :Translation, "sgtn-client/translation"
4
- autoload :Config, "sgtn-client/config"
5
- autoload :Logging, "sgtn-client/logging"
3
+ autoload :Translation, "sgtn-client/api/translation"
4
+ autoload :Config, "sgtn-client/core/config"
5
+ autoload :Logging, "sgtn-client/core/logging"
6
+ autoload :Exceptions, "sgtn-client/core/exceptions"
6
7
 
7
8
  class << self
8
9
  def configure(options = {}, &block)
@@ -11,10 +12,22 @@ module SgtnClient
11
12
 
12
13
  include Logging
13
14
  def load(*args)
14
- SgtnClient::Config.load(*args)
15
- file = File.open('./sgtnclient.log', 'a')
16
- file.sync = true
17
- SgtnClient.logger = Logger.new(file)
15
+ begin
16
+ SgtnClient::Config.load(args[0], args[1])
17
+ rescue => exception
18
+ file = File.open('./error.log', 'a')
19
+ file.sync = true
20
+ log = Logger.new(file)
21
+ log.error exception.message
22
+ end
23
+
24
+ file = './sgtnclient_d.log'
25
+ if args[2] != nil
26
+ file = args[2]
27
+ end
28
+ file = File.open(file, 'a')
29
+ file.sync = true
30
+ SgtnClient.logger = Logger.new(file)
18
31
  end
19
32
 
20
33
  def logger
@@ -0,0 +1,11 @@
1
+ {
2
+ "component" : "JAVA",
3
+ "messages" : {
4
+ "com.vmware.loginsight.web.settings.stats.StatsTable.host" : "Host",
5
+ "com.vmware.loginsight.web.settings.stats.StatsTableType.eventsIngestionRatePerSecond" : "Erfassungsrate für Ereignisse (pro Sekunde)",
6
+ "com.vmware.loginsight.web.settings.stats.StatsTableType.eventsIngestionRatePerSecond.help" : "Die tatsächliche Erfassungsrate (Syslog + API) jedes Knotens nach der Nachrichtenneuverteilung.<br />Log Insight-Knoten verteilen Nachrichten neu, um eine gleichmäßige Erfassung pro Knoten zu erzielen und für eine ausgewogene Aufbewahrung und Leistung zu sorgen.<br /><br />Beachten Sie, dass die Erfassungsrate für jeden Knoten unter der konfigurierten maximalen Erfassungsrate eines Knotens liegen muss.<br /><br />Informationen zur tatsächlichen Rate der Ereignisse, die vor der Nachrichtenneuverteilung direkt an jeden Knoten gesandt werden, finden Sie in den Tabellen \"Eingangsrate für Syslog-Ereignisse (pro Sekunde)\" und \"Eingangsrate für API-Ereignisse (pro Sekunde)\" unten.",
7
+ "com.vmware.loginsight.web.settings.stats.StatsTableType.syslogEventsIncomingRatePerSecond" : "Eingangsrate für Syslog-Ereignisse (pro Sekunde)",
8
+ "com.vmware.loginsight.web.utilities.EmailUtil.upgrade.body48" : "Auf {0} wird nun Version {1} ausgeführt. Es folgen einige interessante neue Funktionen der Version {1}. Wir schätzen wie immer Ihre anhaltende Unterstützung und freuen uns auf Ihre Rückmeldungen unter {3} und {4} auf Twitter.<br /><br /><b>vRealize Log Insight-Serverfunktionen</b><br />• TODO weitere Serverfunktionen hinzufügen.<br /><br /><b>vRealize Log Insight-Agentenfunktionen</b><br />• TODO weitere Agentenfunktionen hinzufügen.<br /><br />Weitere Informationen zu den neuen Funktionen von {0} finden Sie unter {0} v{1} {2}.<br /><br />Viel Spaß bei der Protokollierung<br />Das {0}-Team<br /><br />"
9
+ },
10
+ "locale" : "de"
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "component" : "JAVA",
3
+ "messages" : {
4
+ "com.vmware.loginsight.web.settings.stats.StatsTable.host" : "Host",
5
+ "com.vmware.loginsight.web.settings.stats.StatsTableType.eventsIngestionRatePerSecond" : "Events Ingestion Rate (Per Second)",
6
+ "com.vmware.loginsight.web.settings.stats.StatsTableType.eventsIngestionRatePerSecond.help" : "The actual ingestion rate (syslog + API) of each node after message rebalancing.<br />Log Insight nodes will rebalance messages to attempt uniform ingestion per node for balanced retention and performance.<br /><br />Note that the ingestion rate of each node must be below the ingestion rate configuration maximum for a node.<br /><br />For the actual rate of events being sent directly to each node prior to message rebalancing, see the Syslog Events Incoming Rate (Per Second) and API Events Incoming Rate (Per Second) tables below.",
7
+ "com.vmware.loginsight.web.settings.stats.StatsTableType.syslogEventsIncomingRatePerSecond" : "Syslog Events Incoming Rate (Per Second)",
8
+ "com.vmware.loginsight.web.actions.settings.HealthActionBean.machineLearningAliases" : "Machine Learning Aliases"
9
+ },
10
+ "locale" : "en"
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "component" : "JAVA",
3
+ "messages" : {
4
+ "com.vmware.loginsight.web.settings.stats.StatsTableType.queryOrigin" : "Query Origin",
5
+ "com.vmware.loginsight.web.settings.stats.StatsTableType.queryOrigin.help" : "The origin refers to where the query originated from:<br /><br />Interactive Analytics<br />• <span style=\"font-weight: bold;\">Chart</span> - visualization above the search bar<br />• <span style=\"font-weight: bold;\">Events</span> - tab below the search bar<br />• <span style=\"font-weight: bold;\">Event Types</span> - tab below the search bar<br />• <span style=\"font-weight: bold;\">Event Trends</span> - tab below the search bar<br />• <span style=\"font-weight: bold;\">Alerts</span> - from the alert icon to the right of the search bar<br />• <span style=\"font-weight: bold;\">Facet</span> - chart when expanding a field<br /><br />Internal<br />• <span style=\"font-weight: bold;\">Precompute</span> - cache queries<br />• <span style=\"font-weight: bold;\">Schema</span>\t- machine learning queries<br />• <span style=\"font-weight: bold;\">Tools</span> - internal-only<br />• <span style=\"font-weight: bold;\">Other</span> - internal-only<br />",
6
+ "com.vmware.loginsight.web.settings.stats.StatsTableType.eventsIngestionRatePerSecond" : "Events Ingestion Rate (Per Second)",
7
+ "com.vmware.loginsight.web.settings.stats.StatsTable.host" : "Host",
8
+ "com.vmware.loginsight.web.utilities.EmailUtil.upgrade.body48" : "{0} is now running version {1}. Below are some of the exciting new features we've added to the {1} release. As always, we appreciate your continued support and value your feedback in our {3} and {4} on Twitter.<br /><br /><b>vRealize Log Insight Server Features</b><br />• TODO add server features.<br /><br /><b>vRealize Log Insight Agent Features</b><br />• TODO add agent features.<br /><br />For more information about {0}'s new features, take a look at the {0} v{1} {2}.<br /><br />Happy Logging,<br />The {0} Team<br /><br \\>"
9
+ },
10
+ "locale" : "latest"
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "component" : "JAVA",
3
+ "messages" : {
4
+ "com.vmware.loginsight.web.settings.stats.StatsTable.host" : "主机",
5
+ "com.vmware.loginsight.web.settings.stats.StatsTableType.eventsIngestionRatePerSecond" : "事件载入速率 (每秒)",
6
+ "com.vmware.loginsight.web.settings.stats.StatsTableType.eventsIngestionRatePerSecond.help" : "消息再平衡之后每个节点的实际载入速率 (syslog + API)。<br />Log Insight 节点将再平衡消息以尝试每节点的统一载入,从而实现平衡保留和性能。<br /><br />请注意,每个节点的载入速率必须低于配置的最大节点载入速率。<br /><br />有关消息再平衡之前直接发送到每个节点的事件的实际速率,请参见下述“Syslog 事件入站速率 (每秒)”和“API 事件入站速率 (每秒)”表。",
7
+ "com.vmware.loginsight.web.settings.stats.StatsTableType.syslogEventsIncomingRatePerSecond" : "Syslog 事件入站速率 (每秒)",
8
+ "com.vmware.loginsight.web.utilities.EmailUtil.upgrade.body48" : "{0} 现在正在运行版本 {1}。下面是 {1} 版本中新增的一些出色功能。我们感谢您一如既往地支持,同时非常重视您通过 Twitter 针对我们的 {3} 和 {4} 提供的反馈。<br /><br /><b>vRealize Log Insight 服务器功能</b><br />• TODO 增加服务器功能。<br /><br /><b>vRealize Log Insight 代理功能</b><br />• TODO 增加代理功能。<br /><br />有关 {0} 的新功能的详细信息,请查看 {0} v{1} {2}。<br /><br />祝您使用愉快!<br />{0} 团队<br /><br />"
9
+ },
10
+ "locale" : "zh-Hans"
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "component" : "JAVA",
3
+ "messages" : {
4
+ "com.vmware.loginsight.web.settings.stats.StatsTable.host" : "主機",
5
+ "com.vmware.loginsight.web.settings.stats.StatsTableType.eventsIngestionRatePerSecond" : "事件擷取速率 (每秒)",
6
+ "com.vmware.loginsight.web.settings.stats.StatsTableType.eventsIngestionRatePerSecond.help" : "訊息重新平衡之後每個節點的實際擷取速率 (syslog + API)。<br /> Log Insight 節點將重新平衡訊息,以嘗試每個節點的統一擷取,進而取得平衡保留和效能。<br /><br /> 請注意,每個節點的擷取速率必須低於節點的擷取速率組態上限。<br /><br /> 如需在訊息重新平衡之前直接傳送至每個節點的事件的實際速率,請參閱下列「Syslog 事件傳入速率 (每秒)」和「API 事件傳入速率 (每秒)」資料表。",
7
+ "com.vmware.loginsight.web.settings.stats.StatsTableType.syslogEventsIncomingRatePerSecond" : "Syslog 事件傳入速率 (每秒)",
8
+ "com.vmware.loginsight.web.utilities.EmailUtil.upgrade.body48" : "{0} 現在正在執行版本 {1}。以下是已新增至 {1} 版本的部分嶄新功能。我們感謝您一直以來的支持,並十分重視您在 Twitter 對我們的 {3} 和 {4} 所提供的意見。<br /><br /><b>vRealize Log Insight 伺服器功能</b><br />• TODO 新增伺服器功能。<br /><br /><b>vRealize Log Insight 代理程式功能</b><br />• TODO 新增代理程式功能。<br /><br />如需關於 {0} 新功能的詳細資訊,請查看 {0} v{1} {2}。<br /><br />祝您使用愉快!<br />{0} 團隊<br /><br />"
9
+ },
10
+ "locale" : "zh-Hant"
11
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "de" : "grm-tos-360",
3
+ "zh-Hans" : "grm-tos-360",
4
+ "zh-Hant" : "grm-tos-360",
5
+ "ko" : "grm-tos-360",
6
+ "ja" : "grm-tos-360",
7
+ "en" : "grm-tos-360",
8
+ "fr" : "grm-tos-360",
9
+ "es" : "grm-tos-360"
10
+ }
@@ -0,0 +1,38 @@
1
+ {
2
+ "drop_id" : "1553634594698",
3
+ "4.8.0" : {
4
+ "JS" : {
5
+ "zh-Hant" : "",
6
+ "latest" : "",
7
+ "fr" : "",
8
+ "ko" : "",
9
+ "zh-Hans" : "",
10
+ "es" : "",
11
+ "en" : "",
12
+ "ja" : "",
13
+ "de" : ""
14
+ },
15
+ "JSP" : {
16
+ "zh-Hant" : "",
17
+ "latest" : "",
18
+ "fr" : "",
19
+ "ko" : "",
20
+ "zh-Hans" : "",
21
+ "es" : "",
22
+ "en" : "",
23
+ "ja" : "",
24
+ "de" : ""
25
+ },
26
+ "JAVA" : {
27
+ "zh-Hant" : "",
28
+ "latest" : "",
29
+ "fr" : "",
30
+ "ko" : "",
31
+ "zh-Hans" : "",
32
+ "es" : "",
33
+ "en" : "",
34
+ "ja" : "",
35
+ "de" : ""
36
+ }
37
+ }
38
+ }
@@ -25,6 +25,12 @@ test: &default
25
25
  # # HTTP Proxy
26
26
  vip_server: https://g11n-vip-dev-1.eng.vmware.com:8090
27
27
 
28
+ # # mode of bundle: online/offline
29
+ bundle_mode: offline
30
+
31
+ # # Offline Bundle Path
32
+ offline_bundle: ./spec/config/locales
33
+
28
34
  development:
29
35
  <<: *default
30
36
 
data/spec/spec_helper.rb CHANGED
@@ -11,16 +11,17 @@ if ENV['COVERAGE']
11
11
  end
12
12
 
13
13
  Bundler.require :default, :test
14
- SgtnClient.load("./spec/config/sgtnclient.yml", "test")
14
+ #SgtnClient.load("./spec/config/sgtnclient.yml", "test")
15
15
 
16
16
  #require 'SgtnClient'
17
17
 
18
18
  include SgtnClient
19
19
  include SgtnClient::Logging
20
+ include SgtnClient::Exceptions
20
21
 
21
22
  require 'logger'
22
- SgtnClient.load("./spec/config/sgtnclient.yml", "test")
23
- SgtnClient.logger = Logger.new(STDERR)
23
+
24
+ SgtnClient.load("./spec/config/sgtnclient.yml", "test", './sgtnclient.log')
24
25
 
25
26
  Dir[File.expand_path("../support/**/*.rb", __FILE__)].each {|f| require f }
26
27
 
@@ -1,11 +1,27 @@
1
+ require 'spec_helper'
1
2
  require_relative '../../lib/sgtn-client.rb'
2
3
 
3
4
  describe SgtnClient do
4
5
 
5
- describe "config" do
6
- SgtnClient.load("./spec/config/sgtnclient.yml", "test")
7
- after do
8
- SgtnClient.log = nil
6
+ describe "loadconfig" do
7
+
8
+ before :each do
9
+ SgtnClient.load("./spec/config/sgtnclient.yml", "test", './sgtnclient_config.log')
10
+ end
11
+
12
+ it "define configuration" do
13
+ env = SgtnClient::Config.default_environment
14
+ mode = SgtnClient::Config.configurations[env]["mode"]
15
+ expect(mode).to eq 'sandbox'
9
16
  end
17
+
18
+ it "not define configuration" do
19
+ begin
20
+ SgtnClient::Config.config("aa", { :app_id => "XYZ" })
21
+ rescue => exception
22
+ expect(exception.message).to eq 'Configuration[aa] NotFound'
23
+ end
24
+ end
25
+
10
26
  end
11
27
  end
@@ -15,7 +15,7 @@ describe SgtnClient::Logging do
15
15
  #file = File.open('./spec/unit/foo.log', File::WRONLY | File::APPEND)
16
16
  #Logging.logger = Logger.new(file)
17
17
  #SgtnClient.logger = Logger.new(file)
18
- SgtnClient.load("./spec/config/sgtnclient.yml", "test")
18
+ SgtnClient.load("./spec/config/sgtnclient.yml", "test", './sgtnclient.log')
19
19
  end
20
20
 
21
21
  it "get logger object" do
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ describe SgtnClient do
4
+ describe "OfflineAPI" do
5
+
6
+ before :each do
7
+ env = SgtnClient::Config.default_environment
8
+ SgtnClient::Config.configurations[env]["bundle_mode"] = 'offline'
9
+ end
10
+
11
+ it "GET" do
12
+ expect(SgtnClient::Translation.getString("JAVA", "com.vmware.loginsight.web.settings.stats.StatsTable.host", "zh-Hans")).to eq '主机'
13
+ end
14
+ end
15
+
16
+ end
@@ -1,11 +1,16 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe SgtnClient do
4
- describe "API" do
4
+ describe "OnelineAPI" do
5
+
6
+ before :each do
7
+ env = SgtnClient::Config.default_environment
8
+ SgtnClient::Config.configurations[env]["bundle_mode"] = 'online'
9
+ end
10
+
5
11
  it "GET" do
6
- #SgtnClient.load("./spec/config/sgtnclient.yml", "test")
7
12
  expect(SgtnClient::Translation.getString("JAVA", "com.vmware.loginsight.web.settings.stats.StatsTable.host", "zh-Hans")).to eq '主机'
8
13
  end
9
14
  end
10
-
15
+
11
16
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: singleton-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - VMware G11n Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-14 00:00:00.000000000 Z
11
+ date: 2021-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -211,14 +211,21 @@ extra_rdoc_files:
211
211
  files:
212
212
  - README.md
213
213
  - lib/sgtn-client.rb
214
+ - spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_de.json
215
+ - spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_en.json
216
+ - spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_latest.json
217
+ - spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_zh-Hans.json
218
+ - spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_zh-Hant.json
219
+ - spec/config/locales/l10n/bundles/logInsight/4.8.1/creation.json
220
+ - spec/config/locales/l10n/bundles/logInsight/4.8.1/version.json
214
221
  - spec/config/sample_data.yml
215
222
  - spec/config/sgtnclient.yml
216
223
  - spec/log/http.log
217
224
  - spec/spec_helper.rb
218
225
  - spec/support/sample_data.rb
219
226
  - spec/unit/config_spec.rb
220
- - spec/unit/foo.log
221
227
  - spec/unit/logging_spec.rb
228
+ - spec/unit/offclient_spec.rb
222
229
  - spec/unit/restclient_spec.rb
223
230
  - spec/unit/version_spec.rb
224
231
  homepage: https://github.com/vmware/singleton
@@ -245,13 +252,20 @@ signing_key:
245
252
  specification_version: 4
246
253
  summary: Singleton client for Ruby.
247
254
  test_files:
255
+ - spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_de.json
256
+ - spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_en.json
257
+ - spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_latest.json
258
+ - spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_zh-Hans.json
259
+ - spec/config/locales/l10n/bundles/logInsight/4.8.1/JAVA/messages_zh-Hant.json
260
+ - spec/config/locales/l10n/bundles/logInsight/4.8.1/creation.json
261
+ - spec/config/locales/l10n/bundles/logInsight/4.8.1/version.json
248
262
  - spec/config/sample_data.yml
249
263
  - spec/config/sgtnclient.yml
250
264
  - spec/log/http.log
251
265
  - spec/spec_helper.rb
252
266
  - spec/support/sample_data.rb
253
267
  - spec/unit/config_spec.rb
254
- - spec/unit/foo.log
255
268
  - spec/unit/logging_spec.rb
269
+ - spec/unit/offclient_spec.rb
256
270
  - spec/unit/restclient_spec.rb
257
271
  - spec/unit/version_spec.rb
data/spec/unit/foo.log DELETED
File without changes