pact-ffi 0.0.2-aarch64-linux → 0.0.3-aarch64-linux

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,143 @@
1
+ # require 'pact-ffi/version'
2
+ require 'ffi'
3
+ require 'pact/detect_os'
4
+
5
+ module PactFfi
6
+ module Utils
7
+ extend FFI::Library
8
+ ffi_lib DetectOS.get_bin_path
9
+
10
+ DetectOS.windows? || DetectOS.linux_arm? ? (typedef :uint32, :uint32_type) : (typedef :uint32_t, :uint32_type)
11
+ FfiSpecificationVersion = Hash[
12
+ 'SPECIFICATION_VERSION_UNKNOWN' => 0,
13
+ 'SPECIFICATION_VERSION_V1' => 1,
14
+ 'SPECIFICATION_VERSION_V1_1' => 2,
15
+ 'SPECIFICATION_VERSION_V2' => 3,
16
+ 'SPECIFICATION_VERSION_V3' => 4,
17
+ 'SPECIFICATION_VERSION_V4' => 5,
18
+ ]
19
+ FfiWritePactResponse = Hash[
20
+ 'SUCCESS' => 0,
21
+ 'GENERAL_PANIC' => 1,
22
+ 'UNABLE_TO_WRITE_PACT_FILE' => 2,
23
+ 'MOCK_SERVER_NOT_FOUND' => 3,
24
+ ]
25
+ FfiWriteMessagePactResponse = Hash[
26
+ 'SUCCESS' => 0,
27
+ 'UNABLE_TO_WRITE_PACT_FILE' => 1,
28
+ 'MESSAGE_HANDLE_INVALID' => 2,
29
+ 'MOCK_SERVER_NOT_FOUND' => 3,
30
+ ]
31
+ FfiConfigurePluginResponse = Hash[
32
+ 'SUCCESS' => 0,
33
+ 'GENERAL_PANIC' => 1,
34
+ 'FAILED_TO_LOAD_PLUGIN' => 2,
35
+ 'PACT_HANDLE_INVALID' => 3,
36
+ ]
37
+ FfiPluginInteractionResponse = Hash[
38
+ 'SUCCESS' => 0,
39
+ 'A_GENERAL_PANIC_WAS_CAUGHT' => 1,
40
+ 'MOCK_SERVER_HAS_ALREADY_BEEN_STARTED' => 2,
41
+ 'INTERACTION_HANDLE_IS_INVALID' => 3,
42
+ 'CONTENT_TYPE_IS_NOT_VALID' => 4,
43
+ 'CONTENTS_JSON_IS_NOT_VALID_JSON' => 5,
44
+ 'PLUGIN_RETURNED_AN_ERROR' => 6,
45
+ ]
46
+ FfiInteractionPart = Hash[
47
+ 'INTERACTION_PART_REQUEST' => 0,
48
+ 'INTERACTION_PART_RESPONSE' => 1,
49
+ ]
50
+ # /*
51
+ # -1 A null pointer was received
52
+ # -2 The pact JSON could not be parsed
53
+ # -3 The mock server could not be started
54
+ # -4 The method panicked
55
+ # -5 The address is not valid
56
+ # -6 Could not create the TLS configuration with the self-signed certificate
57
+ # */
58
+ FfiPluginCreateMockServerErrors = Hash[
59
+ 'NULL_POINTER' => -1,
60
+ 'JSON_PARSE_ERROR' => -2,
61
+ 'MOCK_SERVER_START_FAIL' => -3,
62
+ 'CORE_PANIC' => -4,
63
+ 'ADDRESS_NOT_VALID' => -5,
64
+ 'TLS_CONFIG' => -6,
65
+ ]
66
+
67
+ FfiPluginFunctionResult = Hash[
68
+ 'RESULT_OK' => 0,
69
+ 'RESULT_FAILED' => 1,
70
+ ]
71
+
72
+ attach_function :match_message, :pactffi_match_message, %i[pointer pointer], :pointer
73
+ attach_function :mismatches_get_iter, :pactffi_mismatches_get_iter, %i[pointer], :pointer
74
+ attach_function :mismatches_delete, :pactffi_mismatches_delete, %i[pointer], :void
75
+ attach_function :mismatches_iter_next, :pactffi_mismatches_iter_next, %i[pointer], :pointer
76
+ attach_function :mismatches_iter_delete, :pactffi_mismatches_iter_delete, %i[pointer], :void
77
+ attach_function :mismatch_to_json, :pactffi_mismatch_to_json, %i[pointer], :string
78
+ attach_function :mismatch_type, :pactffi_mismatch_type, %i[pointer], :string
79
+ attach_function :mismatch_summary, :pactffi_mismatch_summary, %i[pointer], :string
80
+ attach_function :mismatch_description, :pactffi_mismatch_description, %i[pointer], :string
81
+ attach_function :mismatch_ansi_description, :pactffi_mismatch_ansi_description, %i[pointer], :string
82
+ attach_function :get_error_message, :pactffi_get_error_message, %i[string int32], :int32
83
+ attach_function :parse_pact_json, :pactffi_parse_pact_json, %i[string], :pointer
84
+ attach_function :pact_model_delete, :pactffi_pact_model_delete, %i[pointer], :void
85
+ attach_function :pact_model_interaction_iterator, :pactffi_pact_model_interaction_iterator, %i[pointer], :pointer
86
+ attach_function :pact_spec_version, :pactffi_pact_spec_version, %i[pointer], :int32
87
+ attach_function :pact_interaction_delete, :pactffi_pact_interaction_delete, %i[pointer], :void
88
+ attach_function :consumer_get_name, :pactffi_consumer_get_name, %i[pointer], :string
89
+ attach_function :pact_get_consumer, :pactffi_pact_get_consumer, %i[pointer], :pointer
90
+ attach_function :pact_consumer_delete, :pactffi_pact_consumer_delete, %i[pointer], :void
91
+ attach_function :parse_matcher_definition, :pactffi_parse_matcher_definition, %i[string], :pointer
92
+ attach_function :matcher_definition_error, :pactffi_matcher_definition_error, %i[pointer], :string
93
+ attach_function :matcher_definition_value, :pactffi_matcher_definition_value, %i[pointer], :string
94
+ attach_function :matcher_definition_delete, :pactffi_matcher_definition_delete, %i[pointer], :void
95
+ attach_function :matcher_definition_generator, :pactffi_matcher_definition_generator, %i[pointer], :pointer
96
+ attach_function :matcher_definition_value_type, :pactffi_matcher_definition_value_type, %i[pointer], :int32
97
+ attach_function :matching_rule_iter_delete, :pactffi_matching_rule_iter_delete, %i[pointer], :void
98
+ attach_function :matcher_definition_iter, :pactffi_matcher_definition_iter, %i[pointer], :pointer
99
+ attach_function :matching_rule_iter_next, :pactffi_matching_rule_iter_next, %i[pointer], :pointer
100
+ attach_function :matching_rule_id, :pactffi_matching_rule_id, %i[pointer], :uint16
101
+ attach_function :matching_rule_value, :pactffi_matching_rule_value, %i[pointer], :string
102
+ attach_function :matching_rule_pointer, :pactffi_matching_rule_pointer, %i[pointer], :pointer
103
+ attach_function :matching_rule_reference_name, :pactffi_matching_rule_reference_name, %i[pointer], :string
104
+ attach_function :validate_datetime, :pactffi_validate_datetime, %i[string string], :int32
105
+ attach_function :generator_to_json, :pactffi_generator_to_json, %i[pointer], :string
106
+ attach_function :generator_generate_string, :pactffi_generator_generate_string, %i[pointer string], :string
107
+ attach_function :generator_generate_integer, :pactffi_generator_generate_integer, %i[pointer string], :uint16
108
+ attach_function :generators_iter_delete, :pactffi_generators_iter_delete, %i[pointer], :void
109
+ attach_function :generators_iter_next, :pactffi_generators_iter_next, %i[pointer], :pointer
110
+ attach_function :generators_iter_pair_delete, :pactffi_generators_iter_pair_delete, %i[pointer], :void
111
+ attach_function :matching_rule_to_json, :pactffi_matching_rule_to_json, %i[pointer], :string
112
+ attach_function :matching_rules_iter_delete, :pactffi_matching_rules_iter_delete, %i[pointer], :void
113
+ attach_function :matching_rules_iter_next, :pactffi_matching_rules_iter_next, %i[pointer], :pointer
114
+ attach_function :matching_rules_iter_pair_delete, :pactffi_matching_rules_iter_pair_delete, %i[pointer], :void
115
+ attach_function :provider_state_iter_next, :pactffi_provider_state_iter_next, %i[pointer], :pointer
116
+ attach_function :provider_state_iter_delete, :pactffi_provider_state_iter_delete, %i[pointer], :void
117
+ attach_function :provider_get_name, :pactffi_provider_get_name, %i[pointer], :string
118
+ attach_function :pact_get_provider, :pactffi_pact_get_provider, %i[pointer], :pointer
119
+ attach_function :pact_provider_delete, :pactffi_pact_provider_delete, %i[pointer], :void
120
+ attach_function :provider_state_get_name, :pactffi_provider_state_get_name, %i[pointer], :string
121
+ attach_function :provider_state_get_param_iter, :pactffi_provider_state_get_param_iter, %i[pointer], :pointer
122
+ attach_function :provider_state_param_iter_next, :pactffi_provider_state_param_iter_next, %i[pointer], :pointer
123
+ attach_function :provider_state_delete, :pactffi_provider_state_delete, %i[pointer], :void
124
+ attach_function :provider_state_param_iter_delete, :pactffi_provider_state_param_iter_delete, %i[pointer], :void
125
+ attach_function :provider_state_param_pair_delete, :pactffi_provider_state_param_pair_delete, %i[pointer], :void
126
+ attach_function :string_delete, :pactffi_string_delete, %i[string], :void
127
+ attach_function :generate_datetime_string, :pactffi_generate_datetime_string, %i[string], :pointer
128
+ attach_function :check_regex, :pactffi_check_regex, %i[string string], :bool
129
+ attach_function :generate_regex_value, :pactffi_generate_regex_value, %i[string], :pointer
130
+ attach_function :free_string, :pactffi_free_string, %i[string], :void
131
+ attach_function :new_pact, :pactffi_new_pact, %i[string string], :uint16
132
+ attach_function :interaction_contents, :pactffi_interaction_contents, %i[uint32_type int32 string string],
133
+ :uint32_type
134
+ attach_function :matches_string_value, :pactffi_matches_string_value, %i[pointer string string uint8], :string
135
+ attach_function :matches_u64_value, :pactffi_matches_u64_value, %i[pointer ulong_long ulong_long uint8], :string
136
+ attach_function :matches_i64_value, :pactffi_matches_i64_value, %i[pointer int64 int64 uint8], :string
137
+ attach_function :matches_f64_value, :pactffi_matches_f64_value, %i[pointer double double uint8], :string
138
+ attach_function :matches_bool_value, :pactffi_matches_bool_value, %i[pointer uint8 uint8 uint8], :string
139
+ attach_function :matches_binary_value, :pactffi_matches_binary_value,
140
+ %i[pointer pointer ulong_long pointer ulong_long uint8], :string
141
+ attach_function :matches_json_value, :pactffi_matches_json_value, %i[pointer string string uint8], :string
142
+ end
143
+ end
@@ -0,0 +1,61 @@
1
+ # require 'pact/native_verifier/version'
2
+ # require 'pact/native_verifier/app'
3
+
4
+ # require 'pact-ffi/version'
5
+ require 'ffi'
6
+ require 'pact/detect_os'
7
+
8
+ module PactFfi
9
+ module Verifier
10
+ extend FFI::Library
11
+ ffi_lib DetectOS.get_bin_path
12
+ DetectOS.windows? || DetectOS.linux_arm? ? (typedef :uint32, :uint32_type) : (typedef :uint32_t, :uint32_type)
13
+
14
+ # /*
15
+ # * | Error | Description |
16
+ # * |-------|-------------|
17
+ # * | 1 | The verification process failed, see output for errors |
18
+ # * | 2 | A null pointer was received |
19
+ # * | 3 | The method panicked |
20
+ # * | 4 | Invalid arguments were provided to the verification process |
21
+ # */
22
+ Response = Hash[
23
+ 'VERIFICATION_SUCCESSFUL' => 0,
24
+ 'VERIFICATION_FAILED' => 1,
25
+ 'NULL_POINTER_RECEIVED' => 2,
26
+ 'METHOD_PANICKED' => 3,
27
+ 'INVALID_ARGUMENTS' => 4,
28
+ ]
29
+
30
+ attach_function :verify, :pactffi_verify, %i[string], :int32
31
+ attach_function :new, :pactffi_verifier_new_for_application, %i[], :pointer
32
+ attach_function :new_for_application, :pactffi_verifier_new_for_application, %i[string string], :pointer
33
+ attach_function :shutdown, :pactffi_verifier_shutdown, %i[pointer], :void
34
+ attach_function :set_provider_info, :pactffi_verifier_set_provider_info,
35
+ %i[pointer string string string uint16 string], :void
36
+ attach_function :add_provider_transport, :pactffi_verifier_add_provider_transport,
37
+ %i[pointer string uint16 string string], :void
38
+ attach_function :set_filter_info, :pactffi_verifier_set_filter_info, %i[pointer string string uint8], :void
39
+ attach_function :set_provider_state, :pactffi_verifier_set_provider_state, %i[pointer string uint8 uint8], :void
40
+ attach_function :set_verification_options, :pactffi_verifier_set_verification_options, %i[pointer uint8 ulong_long],
41
+ :int32
42
+ attach_function :set_coloured_output, :pactffi_verifier_set_coloured_output, %i[pointer uint8], :int32
43
+ attach_function :set_no_pacts_is_error, :pactffi_verifier_set_no_pacts_is_error, %i[pointer uint8], :int32
44
+ attach_function :set_publish_options, :pactffi_verifier_set_publish_options,
45
+ %i[pointer string string pointer uint16 string], :int32
46
+ attach_function :set_consumer_filters, :pactffi_verifier_set_consumer_filters, %i[pointer pointer uint16], :void
47
+ attach_function :add_custom_header, :pactffi_verifier_add_custom_header, %i[pointer string string], :void
48
+ attach_function :add_file_source, :pactffi_verifier_add_file_source, %i[pointer string], :void
49
+ attach_function :add_directory_source, :pactffi_verifier_add_directory_source, %i[pointer string], :void
50
+ attach_function :url_source, :pactffi_verifier_url_source, %i[pointer string string string string], :void
51
+ attach_function :broker_source, :pactffi_verifier_broker_source, %i[pointer string string string string], :void
52
+ attach_function :broker_source_with_selectors, :pactffi_verifier_broker_source_with_selectors,
53
+ %i[pointer string string string string uint8 string pointer uint16 string pointer uint16 pointer uint16], :void
54
+ attach_function :execute, :pactffi_verifier_execute, %i[pointer], :int32
55
+ attach_function :cli_args, :pactffi_verifier_cli_args, %i[], :string
56
+ attach_function :logs, :pactffi_verifier_logs, %i[pointer], :string
57
+ attach_function :logs_for_provider, :pactffi_verifier_logs_for_provider, %i[string], :string
58
+ attach_function :output, :pactffi_verifier_output, %i[pointer uint8], :string
59
+ attach_function :json, :pactffi_verifier_json, %i[pointer], :string
60
+ end
61
+ end
@@ -0,0 +1,5 @@
1
+ module Pact
2
+ module Version
3
+ VERSION = '0.4.7'
4
+ end
5
+ end