Javonet.pm untested

filter: Statementstmt 0.0% 0 / 64 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 19 Podpod 0.0% 0 / 8 totaltotal 0.0% 0 / 95 CC 3 SCAR 12.3
CC
3
Cov
0%
set_javonet_working_directory
12.0
BEGIN
2.0
activate
2.0
CRAP 3.4
1 package Javonet::Javonet;
2 use strict;
3 use warnings FATAL => 'all';
4 use Moose;
5 use lib 'lib';
6 use Try::Tiny;
7 use threads;
8 use aliased 'Javonet::Sdk::Internal::RuntimeFactory' => 'RuntimeFactory';
9 use aliased 'Javonet::Core::Transmitter::PerlTransmitter' => 'Transmitter';
10 use aliased 'Javonet::Core::Exception::SdkExceptionHelper' => 'SdkExceptionHelper';
11 use aliased 'Javonet::Sdk::Core::RuntimeLogger' => 'RuntimeLogger';
12 use Exporter qw(import);
13 our @EXPORT = qw(activate in_memory tcp with_config get_runtime_info set_config_source set_javonet_working_directory);
14
15 BEGIN {
16 SdkExceptionHelper->send_exception_to_app_insights("SdkMessage", "Javonet Sdk initialized");
17 }
18
19 sub activate {
20 my($self, $licenseKey) = @_;
21 try {
22 return Transmitter->t_activate($licenseKey);
23 } catch {
24 Javonet::Core::Exception::SdkExceptionHelper->send_exception_to_app_insights($_,"licenseFile");
25 die($_);
26 };
27 }
28
29 sub in_memory {
30 return RuntimeFactory->new(Javonet::Sdk::Internal::ConnectionType::get_connection_type('InMemory'), undef, undef);
31 }
32
33 sub tcp {
34 my $class = shift;
35 my $address = shift;
36 return RuntimeFactory->new(Javonet::Sdk::Internal::ConnectionType::get_connection_type('Tcp'), $address, undef);
37 }
38
39 sub with_config {
40 my ($self, $config_path) = @_;
41 try {
42 Transmitter->t_set_config_source($config_path);
43 return RuntimeFactory->new(Javonet::Sdk::Internal::ConnectionType::get_connection_type('WithConfig'), undef, $config_path);
44 } catch {
45 SdkExceptionHelper->send_exception_to_app_insights("SdkException", $_);
46 die $_;
47 };
48 }
49
50 sub get_runtime_info() {
51 RuntimeLogger->rl_get_runtime_info();
52 }
53
54 sub set_config_source {
55 my ($self, $config_path) = @_;
56 try {
57 Transmitter->t_set_config_source($config_path);
58 } catch {
59 SdkExceptionHelper->send_exception_to_app_insights("SdkException", $_);
60 die $_;
61 };
62 }
63
64 # Sets the working directory for the Javonet SDK.
65 # @param $path [String] The working directory path.
66 sub set_javonet_working_directory {
67 my ($self, $path) = @_;
68 try {
69 $path =~ s{\\}{/}g;
70 $path .= '/' unless $path =~ m{/$};
71 mkdir $path, 0700 unless -d $path;
72 #ActivationHelper->working_directory($path);
73 Transmitter->t_set_javonet_working_directory($path);
74 } catch {
75 SdkExceptionHelper->send_exception_to_app_insights("SdkException", $_);
76 die $_;
77 };
78 }
79
80
81
82 1;